summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-08-10 16:22:08 -0400
committerJune McEnroe <june@causal.agency>2019-08-10 16:22:08 -0400
commita4e70e8c8dd2c5f367b5baa14d9bf2f39b6fb09d (patch)
treebe174b0768c4241e7dc2988993f0c51be9c05b6c
parentHandle HT (diff)
downloadstream-a4e70e8c8dd2c5f367b5baa14d9bf2f39b6fb09d.tar.gz
stream-a4e70e8c8dd2c5f367b5baa14d9bf2f39b6fb09d.zip
Fix RI
It's like reverse-NL, not just scrolling.
-rw-r--r--term.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/term.c b/term.c
index 52e9257..c71d4dc 100644
--- a/term.c
+++ b/term.c
@@ -202,8 +202,13 @@ ACTION(nl) {
 		Y = MIN(Y + 1, B);
 	}
 }
-ACTION(ind) { scrollUp(t, 1); }
-ACTION(ri)  { scrollDown(t, 1); }
+ACTION(ri) {
+	if (Y == t->scroll.top) {
+		scrollDown(t, 1);
+	} else {
+		if (Y) Y--;
+	}
+}
 ACTION(su)  { scrollUp(t, MIN(P(0, 1), t->scroll.bot - t->scroll.top)); }
 ACTION(sd)  { scrollDown(t, MIN(P(0, 1), t->scroll.bot - t->scroll.top)); }
 ACTION(decstbm) {
@@ -364,7 +369,6 @@ static Action *Actions[][128] = {
 	[ESC]['8'] = decrc,
 	[ESC]['='] = nop,
 	[ESC]['>'] = nop,
-	[ESC]['D'] = ind,
 	[ESC]['M'] = ri,
 	[ESC]['['] = csi,
 	[ESC][']'] = osc,