Fix save/restore cursor

st was assuming that save/restore cursor position was independent
of the screen that was shown in each moment, but it is not true,
because each screen has a different save/restore buffer. This
patch fixes it.
master
Mihail Zenkov 11 years ago committed by Roberto E. Vargas Caballero
parent 2b1bc8087f
commit 62ab938965

15
st.c

@ -1342,13 +1342,14 @@ tfulldirt(void) {
void void
tcursor(int mode) { tcursor(int mode) {
static TCursor c; static TCursor c[2];
bool alt = IS_SET(MODE_ALTSCREEN);
if(mode == CURSOR_SAVE) { if(mode == CURSOR_SAVE) {
c = term.c; c[alt] = term.c;
} else if(mode == CURSOR_LOAD) { } else if(mode == CURSOR_LOAD) {
term.c = c; term.c = c[alt];
tmoveto(c.x, c.y); tmoveto(c[alt].x, c[alt].y);
} }
} }
@ -1854,12 +1855,12 @@ tsetmode(bool priv, bool set, int *args, int narg) {
case 1034: case 1034:
MODBIT(term.mode, set, MODE_8BIT); MODBIT(term.mode, set, MODE_8BIT);
break; break;
case 1049: /* = 1047 and 1048 */ case 1049: /* swap screen & set/restore cursor as xterm */
case 47: tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
case 47: /* swap screen */
case 1047: case 1047:
if (!allowaltscreen) if (!allowaltscreen)
break; break;
alt = IS_SET(MODE_ALTSCREEN); alt = IS_SET(MODE_ALTSCREEN);
if(alt) { if(alt) {
tclearregion(0, 0, term.col-1, tclearregion(0, 0, term.col-1,

Loading…
Cancel
Save