From b50be8225dd2cd6de35a9b6219c556bac355255c Mon Sep 17 00:00:00 2001 From: Charles Daniels Date: Fri, 28 Dec 2018 17:23:04 -0500 Subject: [PATCH] fixed bug in handling of S and T CSI escapes When a S or T CSI escape was encountered, the lines which were scrolled away would be deleted from the scrollback buffer. This has been corrected - the lines are now preseved. This fixes a bug where issuing `clear` followed by `lsix` would cause the line on which the `lsix` was issued to disappear from the scrollback buffer. Note that the line may scroll out of view and thus dissapear, but it will now be preserved in the scrollback buffer. --- st.c | 18 ++++++++++++++++-- x.c | 6 +++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/st.c b/st.c index 0991147..43bc7cb 100644 --- a/st.c +++ b/st.c @@ -1822,11 +1822,11 @@ csihandle(void) break; case 'S': /* SU -- Scroll line up */ DEFAULT(csiescseq.arg[0], 1); - tscrollup(term.top, csiescseq.arg[0], 0); + tscrollup(term.top, csiescseq.arg[0], 1); break; case 'T': /* SD -- Scroll line down */ DEFAULT(csiescseq.arg[0], 1); - tscrolldown(term.top, csiescseq.arg[0], 0); + tscrolldown(term.top, csiescseq.arg[0], 1); break; case 'L': /* IL -- Insert blank lines */ DEFAULT(csiescseq.arg[0], 1); @@ -1885,6 +1885,11 @@ csihandle(void) case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ tcursor(CURSOR_LOAD); break; + case 't': + dprintf("CSI t\n"); + /* TODO should probably not be hard-coded */ + ttywrite(";420;720t", 10, 1); + break; case ' ': switch (csiescseq.mode[1]) { case 'q': /* DECSCUSR -- Set Cursor Style */ @@ -1979,6 +1984,15 @@ strhandle(void) redraw(); } return; + case 11: + dprintf("caught OSC 11\n"); + ttywrite("11;rgb:ffff/ffff/ffff", 21, 1); + return; + + case 10: + dprintf("caught OSC 10\n"); + ttywrite("10;rgb:0000/0000/0000", 21, 1); + return; } break; case 'k': /* old title set compatibility */ diff --git a/x.c b/x.c index eda220c..494e189 100644 --- a/x.c +++ b/x.c @@ -1515,8 +1515,8 @@ xfinishdraw(void) XGCValues gcvalues; GC gc; - dprintf("term row=%i col=%i ocx=%i ocy=%i scr=%i\n", term.row, term.col, term.ocx, term.ocy, term.scr); - dprintf("cursor x y %i %i\n", term.c.x, term.c.y); + /* dprintf("term row=%i col=%i ocx=%i ocy=%i scr=%i\n", term.row, term.col, term.ocx, term.ocy, term.scr); */ + /* dprintf("cursor x y %i %i\n", term.c.x, term.c.y); */ XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, win.h, 0, 0); @@ -1545,7 +1545,7 @@ xfinishdraw(void) } } - dprintf("im@0x%08x: x=%i y=%i\n", im, im->x, im->y); + /* dprintf("im@0x%08x: x=%i y=%i\n", im, im->x, im->y); */ if (!im->pixmap) { im->pixmap = (void *)XCreatePixmap(xw.dpy, xw.win, im->width, im->height, DefaultDepth(xw.dpy, xw.scr));