Skip to content

Commit

Permalink
fixed bug in handling of S and T CSI escapes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
charlesdaniels committed Dec 28, 2018
1 parent 1da7858 commit b50be82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions st.c
Original file line number Diff line number Diff line change
Expand Up @@ -1822,11 +1822,11 @@ csihandle(void)
break;
case 'S': /* SU -- Scroll <n> 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 <n> 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 <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit b50be82

Please sign in to comment.