about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-23 14:53:11 -0400
committerJune McEnroe <june@causal.agency>2018-08-23 14:53:11 -0400
commitf3430df949466920e45e171593d95d980cda92ed (patch)
tree1ed97299dbb82849199f16e538c47395716a3ca7
parentAdd C-l to redraw (diff)
downloadtorus-f3430df949466920e45e171593d95d980cda92ed.tar.gz
torus-f3430df949466920e45e171593d95d980cda92ed.zip
Implement I, directional insert
-rw-r--r--client.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/client.c b/client.c
index c7601cd..28ccc4e 100644
--- a/client.c
+++ b/client.c
@@ -195,6 +195,7 @@ static void clientMap(void) {
 static struct {
 	enum {
 		MODE_NORMAL,
+		MODE_DIRECTION,
 		MODE_INSERT,
 		MODE_REPLACE,
 		MODE_DRAW,
@@ -331,11 +332,26 @@ static void inputNormal(wchar_t ch) {
 
 		break; case 'i': insertMode(1, 0);
 		break; case 'a': clientMove(1, 0); insertMode(1, 0);
+		break; case 'I': input.mode = MODE_DIRECTION;
 		break; case 'r': input.mode = MODE_REPLACE;
 		break; case 'R': input.mode = MODE_DRAW; input.draw = 0;
 	}
 }
 
+static void inputDirection(wchar_t ch) {
+	switch (ch) {
+		break; case ESC: input.mode = MODE_NORMAL;
+		break; case 'h': insertMode(-1,  0);
+		break; case 'l': insertMode( 1,  0);
+		break; case 'k': insertMode( 0, -1);
+		break; case 'j': insertMode( 0,  1);
+		break; case 'y': insertMode(-1, -1);
+		break; case 'u': insertMode( 1, -1);
+		break; case 'b': insertMode(-1,  1);
+		break; case 'n': insertMode( 1,  1);
+	}
+}
+
 static void inputInsert(wchar_t ch) {
 	switch (ch) {
 		break; case ESC: {
@@ -391,10 +407,11 @@ static void readInput(void) {
 		return;
 	}
 	switch (input.mode) {
-		break; case MODE_NORMAL:  inputNormal(ch);
-		break; case MODE_INSERT:  inputInsert(ch);
-		break; case MODE_REPLACE: inputReplace(ch);
-		break; case MODE_DRAW:    inputDraw(ch);
+		break; case MODE_NORMAL:    inputNormal(ch);
+		break; case MODE_DIRECTION: inputDirection(ch);
+		break; case MODE_INSERT:    inputInsert(ch);
+		break; case MODE_REPLACE:   inputReplace(ch);
+		break; case MODE_DRAW:      inputDraw(ch);
 	}
 }
 
/td>June McEnroe 2020-03-03Use getopts in shell scriptsJune McEnroe WTF why did no one tell me about this? 2020-02-27Style %T outside of Rs in italicJune McEnroe 2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe 2020-02-23Add This Is How You Lose the Time WarJune McEnroe 2020-02-22Add See Ya LaterJune McEnroe 2020-02-20Remove wiki scriptJune McEnroe Wikipedia seems to have removed the one-sentence extracts from the opensearch results. Too bad. It's not a wiki script, what we need is a command that fetches single-sentence summaries of articles on Wikipedia. 2020-02-19Add The Obelisk GateJune McEnroe 2020-02-17Add Four Tet — HandsJune McEnroe One from the cafe that caught my attention. 2020-02-12Simplify macOS notify-sendJune McEnroe 2020-02-12Add imbox and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe