diff options
author | Mihail Zenkov <mihail.zenkov@gmail.com> | 2013-10-01 20:02:24 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2013-10-02 20:47:19 +0200 |
commit | 62ab938965f2673e029ae2e2a4244788e673bd70 (patch) | |
tree | 3bf4d187f7ac6614ac009c73edba192abc16464c | |
parent | 2b1bc8087f232a7b0ba4c7233e76be7abae25a88 (diff) | |
download | st-patched-62ab938965f2673e029ae2e2a4244788e673bd70.tar.bz2 st-patched-62ab938965f2673e029ae2e2a4244788e673bd70.tar.xz st-patched-62ab938965f2673e029ae2e2a4244788e673bd70.zip |
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.
-rw-r--r-- | st.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1342,13 +1342,14 @@ tfulldirt(void) { | |||
1342 | 1342 | ||
1343 | void | 1343 | void |
1344 | tcursor(int mode) { | 1344 | tcursor(int mode) { |
1345 | static TCursor c; | 1345 | static TCursor c[2]; |
1346 | bool alt = IS_SET(MODE_ALTSCREEN); | ||
1346 | 1347 | ||
1347 | if(mode == CURSOR_SAVE) { | 1348 | if(mode == CURSOR_SAVE) { |
1348 | c = term.c; | 1349 | c[alt] = term.c; |
1349 | } else if(mode == CURSOR_LOAD) { | 1350 | } else if(mode == CURSOR_LOAD) { |
1350 | term.c = c; | 1351 | term.c = c[alt]; |
1351 | tmoveto(c.x, c.y); | 1352 | tmoveto(c[alt].x, c[alt].y); |
1352 | } | 1353 | } |
1353 | } | 1354 | } |
1354 | 1355 | ||
@@ -1854,12 +1855,12 @@ tsetmode(bool priv, bool set, int *args, int narg) { | |||
1854 | case 1034: | 1855 | case 1034: |
1855 | MODBIT(term.mode, set, MODE_8BIT); | 1856 | MODBIT(term.mode, set, MODE_8BIT); |
1856 | break; | 1857 | break; |
1857 | case 1049: /* = 1047 and 1048 */ | 1858 | case 1049: /* swap screen & set/restore cursor as xterm */ |
1858 | case 47: | 1859 | tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); |
1860 | case 47: /* swap screen */ | ||
1859 | case 1047: | 1861 | case 1047: |
1860 | if (!allowaltscreen) | 1862 | if (!allowaltscreen) |
1861 | break; | 1863 | break; |
1862 | |||
1863 | alt = IS_SET(MODE_ALTSCREEN); | 1864 | alt = IS_SET(MODE_ALTSCREEN); |
1864 | if(alt) { | 1865 | if(alt) { |
1865 | tclearregion(0, 0, term.col-1, | 1866 | tclearregion(0, 0, term.col-1, |