ref: 878a7dedb8bf02e993773057792110612ae30969
parent: 37879732644669be2cd9a93db4e3cda144c2fcdf
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Feb 15 14:57:05 EST 2020
plan9: handle ctrl
--- a/plan9.c
+++ b/plan9.c
@@ -666,7 +666,7 @@
Mouse m;
char tmp[256];
Channel *kchan;
- int oldw, oldh, w, h, n, shiftdown, complete;
+ int oldw, oldh, w, h, n, shiftdown, complete, movex, movey;
Alt a[Numchan+1] = {
[Cchar] = { nil, &key.rune, CHANRCV },
[Ckey] = { nil, &key, CHANRCV },
@@ -725,6 +725,8 @@
shiftdown = 0;
altdown = 0;
complete = 1;
+ movex = 1;
+ movey = 1;
for (;;) {
redraw(complete);
@@ -777,6 +779,18 @@
case Kalt:
altdown = key.down;
break;
+ case Kctl:
+ movex = key.down ? gridw : 1;
+ movey = key.down ? gridh : 1;
+ break;
+ case Kup:
+ case Kdown:
+ case Kleft:
+ case Kright:
+ break;
+ default:
+// fprint(2, "unknown key down/up 0x%x\n", key.rune);
+ break;
}
break;
@@ -788,31 +802,31 @@
case 0x0b: /* C-k */
case Kup:
if (shiftdown || mode == Mselect)
- selh = MAX(1, selh-1);
+ selh = MAX(1, selh-movey);
else {
if (altdown || mode == Mslide)
- selmove(0, -1);
- cury = MAX(0, cury-1);
+ selmove(0, -movey);
+ cury = MAX(0, cury-movey);
}
break;
case '\n': /* C-j */
case Kdown:
if (shiftdown || mode == Mselect)
- selh++;
+ selh += movey;
else {
if (altdown || mode == Mslide)
- selmove(0, 1);
- cury = MIN(h-1, cury+1);
+ selmove(0, movey);
+ cury = MIN(h-1, cury+movey);
}
break;
case Kbs: /* C-h */
case Kleft:
if (shiftdown || mode == Mselect)
- selw = MAX(1, selw-1);
+ selw = MAX(1, selw-movex);
else {
if (altdown || mode == Mslide)
- selmove(-1, 0);
- curx = MAX(0, curx-1);
+ selmove(-movex, 0);
+ curx = MAX(0, curx-movex);
}
break;
case 0x0c: /* C-l */
@@ -822,11 +836,11 @@
}
case Kright:
if (shiftdown || mode == Mselect)
- selw++;
+ selw += movex;
else {
if (altdown || mode == Mslide)
- selmove(1, 0);
- curx = MIN(w-1, curx+1);
+ selmove(movex, 0);
+ curx = MIN(w-1, curx+movex);
}
break;
case Khome: