ref: 63f6c8631792be64af228a766b3b1d4639e91267
parent: 38995602c5afd9943f3a8725796d700bb7a29cea
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Feb 14 14:58:50 EST 2020
plan9: fix C-r and add C-f
--- a/plan9.c
+++ b/plan9.c
@@ -59,10 +59,10 @@
};
static Rune *linebuf;
-static Usz tick;
+static vlong tick;
static int gridw = 8, gridh = 8;
static int rulerstyle = Sfancy, dotstyle = Sfancy;
-static int bpm = 120, pause;
+static int bpm = 120, pause, forward;
static int curx, cury;
static int selw = 1, selh = 1;
static int charw, charh;
@@ -270,13 +270,13 @@
processold = processnew;
processnew = nanosec();
process(&events);
- tick++;
nbsendul(drawchan, 0);
oldn = start;
end = start + 1;
oldbpm = 0;
- for (n = start; pause || n < end; n = nanosec()) {
+ forward = 0;
+ for (n = start; !forward && (pause || n < end); n = nanosec()) {
if (bpm != oldbpm) {
end = start + 15000000000LL/bpm; /* 10^9 * 60 / 4 */
oldbpm = bpm;
@@ -295,7 +295,8 @@
sleep(1);
}
- framedev = ((processnew - processold) - (15000000000LL / bpm)) / 1000LL;
+ framedev = (processnew - processold - 15000000000LL/bpm) / 1000LL;
+ tick++;
}
}
@@ -403,7 +404,7 @@
/* ticks */
p.x += charw * (len + Coloff);
- runesprint(linebuf, "%ludf", tick);
+ runesprint(linebuf, "%lldf", MAX(0, tick));
runestring(screen, p, color[Dfhigh], ZP, font, linebuf);
/* insert/append mode */
@@ -831,7 +832,8 @@
case 0x11: /* C-q */
goto end;
case 0x12: /* C-r */
- tick = 0;
+ tick = -1;
+ forward = 1;
break;
case 0x13: /* C-s */
tmp[0] = 0;
@@ -889,6 +891,9 @@
mode = Minsert;
else
selw = selh = 1;
+ break;
+ case Kack: /* C-f */
+ forward = 1;
break;
case '`':
case '~':