shithub: orca

Download patch

ref: 751cb707f948bb7eabe8eb3eb9993aee3dfbfc86
parent: 5b152a57c84de9861fd82121c547193fdd34a588
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 17 17:04:50 EST 2020

plan9: give up on vim keys, use them for other stuff

--- a/plan9.c
+++ b/plan9.c
@@ -655,17 +655,6 @@
 }
 
 static void
-fieldmodeset(Rune key)
-{
-	if (mode != Mappend) {
-		selset(key);
-	} else {
-		fieldset(cur.x, cur.y, key);
-		curmove(1, 0);
-	}
-}
-
-static void
 selmove(int x, int y)
 {
 	int i;
@@ -1053,8 +1042,9 @@
 
 		case Cchar:
 			switch (key.rune) {
-			case 0x0b: /* C-k */
-				move.y = 1;
+			case '\n': /* C-j */
+				/* FIXME bang it */
+				break;
 			case Kup:
 				if (shiftdown || mode == Mselect)
 					selext(0, -move.y);
@@ -1064,8 +1054,6 @@
 					curmove(0, -move.y);
 				}
 				break;
-			case '\n': /* C-j */
-				move.y = 1;
 			case Kdown:
 				if (shiftdown || mode == Mselect)
 					selext(0, move.y);
@@ -1075,8 +1063,6 @@
 					curmove(0, move.y);
 				}
 				break;
-			case Kbs: /* C-h */
-				move.x = 1;
 			case Kleft:
 				if (shiftdown || mode == Mselect) {
 					selext(-move.x, 0);
@@ -1087,11 +1073,8 @@
 				}
 				break;
 			case 0x0c: /* C-l */
-				move.x = 1;
-				if (shiftdown) { /* FIXME this conflicts with vim keys btw */
-					selmap(tolower);
-					break;
-				}
+				selmap(tolower);
+				break;
 			case Kright:
 				if (shiftdown || mode == Mselect)
 					selext(move.x, 0);
@@ -1184,7 +1167,7 @@
 			case Kins:
 				mode = mode != Mappend ? Mappend : Minsert;
 				break;
-			case Kstx:
+			case 0x0b: /* C-k */
 				tmp[0] = 0;
 				if (enter("command:", tmp, sizeof(tmp), nil, &kctl, nil) > 0)
 					command(tmp);
@@ -1209,9 +1192,16 @@
 				mode = mode != Mselect ? Mselect : Minsert;
 				break;
 			case Knack: /* C-u */
-				if (shiftdown)
-					selmap(toupper);
+				selmap(toupper);
 				break;
+			case Kbs: /* C-h */
+				if (mode != Mappend) {
+					selset('.');
+				} else {
+					curmove(-1, 0);
+					fieldset(cur.x, cur.y, '.');
+				}
+				break;
 			case ' ':
 				if (mode != Mappend) {
 					pause = !pause;
@@ -1221,7 +1211,12 @@
 				if (key.rune == Kdel || key.rune == ' ')
 					key.rune = '.';
 				if (orca_is_valid_glyph(key.rune)) {
-					fieldmodeset(key.rune);
+					if (mode != Mappend) {
+						selset(key.rune);
+					} else {
+						fieldset(cur.x, cur.y, key.rune);
+						curmove(1, 0);
+					}
 				} else {
 //					fprint(2, "unhandled key %04x\n", key.rune);
 					goto noredraw;