History

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

Sigrid Haflínudóttir committed 6 years ago

Commit 751cb701 parent 5b152a51 file · +21 −26Browse files

Unified · Split

plan9.c+21−26
@@ -654,17 +654,6 @@ curmove(int x, int y) · 653 unmodified lines
654654 sel.max = ptclamp(addpt(sel.max, xy));
655655 }
656656
657−static void
658−fieldmodeset(Rune key)
659−{
660− if (mode != Mappend) {
661− selset(key);
662− } else {
663− fieldset(cur.x, cur.y, key);
664− curmove(1, 0);
665− }
666−}
667−
668657 static void
669658 selmove(int x, int y)
670659 {
@@ -1053,8 +1042,9 @@ noredraw: · 382 unmodified lines
10531042
10541043 case Cchar:
10551044 switch (key.rune) {
1056− case 0x0b: /* C-k */
1057− move.y = 1;
1045+ case '\n': /* C-j */
1046+ /* FIXME bang it */
1047+ break;
10581048 case Kup:
10591049 if (shiftdown || mode == Mselect)
10601050 selext(0, -move.y);
@@ -1064,8 +1054,6 @@ noredraw: · 3 unmodified lines
10641054 curmove(0, -move.y);
10651055 }
10661056 break;
1067− case '\n': /* C-j */
1068− move.y = 1;
10691057 case Kdown:
10701058 if (shiftdown || mode == Mselect)
10711059 selext(0, move.y);
@@ -1075,8 +1063,6 @@ noredraw: · 3 unmodified lines
10751063 curmove(0, move.y);
10761064 }
10771065 break;
1078− case Kbs: /* C-h */
1079− move.x = 1;
10801066 case Kleft:
10811067 if (shiftdown || mode == Mselect) {
10821068 selext(-move.x, 0);
@@ -1087,11 +1073,8 @@ noredraw: · 4 unmodified lines
10871073 }
10881074 break;
10891075 case 0x0c: /* C-l */
1090− move.x = 1;
1091− if (shiftdown) { /* FIXME this conflicts with vim keys btw */
1092− selmap(tolower);
1093− break;
1094− }
1076+ selmap(tolower);
1077+ break;
10951078 case Kright:
10961079 if (shiftdown || mode == Mselect)
10971080 selext(move.x, 0);
@@ -1184,7 +1167,7 @@ noredraw: · 86 unmodified lines
11841167 case Kins:
11851168 mode = mode != Mappend ? Mappend : Minsert;
11861169 break;
1187− case Kstx:
1170+ case 0x0b: /* C-k */
11881171 tmp[0] = 0;
11891172 if (enter("command:", tmp, sizeof(tmp), nil, &kctl, nil) > 0)
11901173 command(tmp);
@@ -1209,8 +1192,15 @@ noredraw: · 18 unmodified lines
12091192 mode = mode != Mselect ? Mselect : Minsert;
12101193 break;
12111194 case Knack: /* C-u */
1212− if (shiftdown)
1213− selmap(toupper);
1195+ selmap(toupper);
1196+ break;
1197+ case Kbs: /* C-h */
1198+ if (mode != Mappend) {
1199+ selset('.');
1200+ } else {
1201+ curmove(-1, 0);
1202+ fieldset(cur.x, cur.y, '.');
1203+ }
12141204 break;
12151205 case ' ':
12161206 if (mode != Mappend) {
@@ -1221,7 +1211,12 @@ noredraw: · 4 unmodified lines
12211211 if (key.rune == Kdel || key.rune == ' ')
12221212 key.rune = '.';
12231213 if (orca_is_valid_glyph(key.rune)) {
1224− fieldmodeset(key.rune);
1214+ if (mode != Mappend) {
1215+ selset(key.rune);
1216+ } else {
1217+ fieldset(cur.x, cur.y, key.rune);
1218+ curmove(1, 0);
1219+ }
12251220 } else {
12261221 // fprint(2, "unhandled key %04x\n", key.rune);
12271222 goto noredraw;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t