about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-04 13:00:13 -0500
committerJune McEnroe <june@causal.agency>2019-01-04 13:00:13 -0500
commitdc13b266a2b208c1b40c488b8d14903ec779417c (patch)
tree517a592d7e3e903afafc420d6cf08466b9449bf6
parentAdd indicator of current position in map (diff)
downloadtorus-dc13b266a2b208c1b40c488b8d14903ec779417c.tar.gz
torus-dc13b266a2b208c1b40c488b8d14903ec779417c.zip
Add simplified speed control
-rw-r--r--client.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/client.c b/client.c
index 3647e60..9aa052a 100644
--- a/client.c
+++ b/client.c
@@ -282,10 +282,12 @@ static struct {
 		ModeDraw,
 		ModeLine,
 	} mode;
+	int8_t delta;
 	uint8_t color;
 	uint8_t shift;
 	uint8_t draw;
 } input = {
+	.delta = 1,
 	.color = ColorWhite,
 };
 
@@ -380,10 +382,10 @@ static uint8_t inputCell(wchar_t ch) {
 static void inputNormal(bool keyCode, wchar_t ch) {
 	if (keyCode) {
 		switch (ch) {
-			break; case KEY_LEFT:  clientMove(-1,  0);
-			break; case KEY_RIGHT: clientMove( 1,  0);
-			break; case KEY_UP:    clientMove( 0, -1);
-			break; case KEY_DOWN:  clientMove( 0,  1);
+			break; case KEY_LEFT:  clientMove(-input.delta,  0);
+			break; case KEY_RIGHT: clientMove( input.delta,  0);
+			break; case KEY_UP:    clientMove( 0, -input.delta);
+			break; case KEY_DOWN:  clientMove( 0,  input.delta);
 
 			break; case KEY_F(1): input.shift = 0x00;
 			break; case KEY_F(2): input.shift = 0xC0;
@@ -400,14 +402,16 @@ static void inputNormal(bool keyCode, wchar_t ch) {
 		break; case Esc: modeNormal(); input.shift = 0;
 		break; case 'q': endwin(); exit(EX_OK);
 
-		break; case 'h': clientMove(-1,  0);
-		break; case 'l': clientMove( 1,  0);
-		break; case 'k': clientMove( 0, -1);
-		break; case 'j': clientMove( 0,  1);
-		break; case 'y': clientMove(-1, -1);
-		break; case 'u': clientMove( 1, -1);
-		break; case 'b': clientMove(-1,  1);
-		break; case 'n': clientMove( 1,  1);
+		break; case '\\': input.delta = (input.delta == 1 ? 4 : 1);
+
+		break; case 'h': clientMove(-input.delta,  0);
+		break; case 'l': clientMove( input.delta,  0);
+		break; case 'k': clientMove( 0, -input.delta);
+		break; case 'j': clientMove( 0,  input.delta);
+		break; case 'y': clientMove(-input.delta, -input.delta);
+		break; case 'u': clientMove( input.delta, -input.delta);
+		break; case 'b': clientMove(-input.delta,  input.delta);
+		break; case 'n': clientMove( input.delta,  input.delta);
 
 		break; case '0': colorFg(ColorBlack);
 		break; case '1': colorFg(ColorRed);
ommit/imbox.c?h=1.4&id=e74035fe2110a02f8071c2c29038dbdbb74ed92e&follow=1'>Use EXAMINE rather than SELECTJune McEnroe 2019-12-22Export To and CC headersJune McEnroe 2019-12-22Add missing includeJune McEnroe 2019-12-22Export In-Reply-To headersJune McEnroe 2019-12-21Add git-fetch-email to READMEJune McEnroe 2019-12-21Clarify purpose in READMEJune McEnroe 2019-12-21Add READMEJune McEnroe 2019-12-21Add copyright header to git-fetch-emailJune McEnroe 2019-12-21Add git-fetch-email to SEE ALSO of imboxJune McEnroe 2019-12-21Add git-fetch-email wrapperJune McEnroe 2019-12-21Determine host by SRV lookupJune McEnroe 2019-12-21Clean up remaining codeJune McEnroe 2019-12-21Clean up mboxrd codeJune McEnroe 2019-12-21Convert CRLF to LFJune McEnroe 2019-12-21Implement -CFSTJune McEnroe 2019-12-21Rewrite aspirational manualJune McEnroe 2019-12-21Null-terminate read literalsJune McEnroe