summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2017-01-12 16:28:29 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2017-04-06 11:27:27 +0200
commita48e1f96dc329cd0fc28ed91890dd19f4d12a47c (patch)
tree62712d6533eba9313751f3d7f0f0e968f50b9a39 /src
parent565b8901cad828d921038cd6235501c42d1c9a32 (diff)
downloadscreen-a48e1f96dc329cd0fc28ed91890dd19f4d12a47c.tar.gz
fix restoring cursor position after leaving altscreen
When swapping to altscreen, also swap cursor position Bug: 49883
Diffstat (limited to 'src')
-rw-r--r--src/ansi.c2
-rw-r--r--src/resize.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/ansi.c b/src/ansi.c
index ce27a5c..ec70cf3 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1149,8 +1149,8 @@ static void DoCSI(Window *win, int c, int intermediate)
}
} else {
if (win->w_alt.on) {
- RestoreCursor(win, &win->w_alt.cursor);
LeaveAltScreen(win);
+ RestoreCursor(win, &win->w_alt.cursor);
}
}
if (a1 == 47 && !i)
diff --git a/src/resize.c b/src/resize.c
index a6a741e..0dc032d 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -798,6 +798,14 @@ static void SwapAltScreen(Window *p)
SWAP(width, t);
SWAP(height, t);
+ /* we need to swap cursor positions, but they are not swappable with macro */
+ t = p->w_alt.cursor.x;
+ p->w_alt.cursor.x = p->w_x;
+ p->w_x = t;
+ t = p->w_alt.cursor.y;
+ p->w_alt.cursor.y = p->w_y;
+ p->w_y = t;
+
SWAP(histheight, t);
SWAP(hlines, ml);
SWAP(histidx, t);