From a48e1f96dc329cd0fc28ed91890dd19f4d12a47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Thu, 12 Jan 2017 16:28:29 +0100 Subject: fix restoring cursor position after leaving altscreen When swapping to altscreen, also swap cursor position Bug: 49883 --- src/ansi.c | 2 +- src/resize.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.1