summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-08-06 15:07:56 -0400
committerJune McEnroe <june@causal.agency>2019-08-06 15:07:56 -0400
commitdf46e00f602aa4291c52014f09ca23a86aad5893 (patch)
treeb46a97314fa739b193113800c0e6bf35a9404859
parentFactor out scrolling (diff)
downloadstream-df46e00f602aa4291c52014f09ca23a86aad5893.tar.gz
stream-df46e00f602aa4291c52014f09ca23a86aad5893.zip
Implement SU and SD
-rw-r--r--term.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/term.c b/term.c
index 18eeb66..e77ab67 100644
--- a/term.c
+++ b/term.c
@@ -248,6 +248,8 @@ enum CSI {
 	EL,
 	DL  = 'M',
 	DCH = 'P',
+	SU  = 'S',
+	SD  = 'T',
 	ECH = 'X',
 	VPA = 'd',
 	SM  = 'h',
@@ -331,6 +333,9 @@ static char updateCSI(wchar_t ch) {
 			clear(cell(y, cols - i), cell(y, cols - 1));
 		}
 
+		break; case SU: scrollUp(MIN((n ? ps[0] : 1), scroll.bot - scroll.top));
+		break; case SD: scrollDown(MIN((n ? ps[0] : 1), scroll.bot - scroll.top));
+
 		break; case SM: {
 			switch (ps[0]) {
 				break; case IRM: insert = true;
@@ -347,6 +352,7 @@ static char updateCSI(wchar_t ch) {
 		break; case SGR: updateSGR(ps, p + 1);
 
 		break; case DECSTBM: {
+			// FIXME: Prevent bot < top.
 			scroll.top = (n > 0 ? ps[0] - 1 : 0);
 			scroll.bot = (n > 1 ? ps[1] - 1 : rows - 1);
 		}