From 67f1d48801b28e9867a5862e4d712584c76fd555 Mon Sep 17 00:00:00 2001 From: Jason Hood Date: Sat, 28 Oct 2017 11:19:06 +1000 Subject: [PATCH] Revert back to saving buffer cursor position In v1.70 I had saved the cursor position relative to the window, but that means should the window scroll, the cursor would appear to be restored to the wrong position. It will still be wrong should the *buffer* be scrolled, but that can't really be helped (well, possibly it could, but it would be more effort than it's worth). --- ANSI.c | 13 +++++-------- ansicon.c | 2 +- readme.txt | 7 ++++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ANSI.c b/ANSI.c index cd5473d..f81b5ae 100644 --- a/ANSI.c +++ b/ANSI.c @@ -152,8 +152,9 @@ remove wcstok, avoiding potential interference with the host; similarly, use a private heap instead of malloc. - v1.80, 26 October, 2017: - fix unloading. + v1.80, 26 to 28 October, 2017: + fix unloading; + revert back to (re)storing buffer cursor position. */ #include "ansicon.h" @@ -1076,16 +1077,12 @@ void InterpretEscSeq( void ) case 's': // ESC[s Saves cursor position for recall later if (es_argc != 0) return; - pState->SavePos.X = CUR.X; - pState->SavePos.Y = CUR.Y - TOP; - DEBUGSTR( 1, "SavePos = %u,%u; CUR = %u,%u; TOP = %u, .Top = %u", - pState->SavePos.X, pState->SavePos.Y, CUR.X, CUR.Y, TOP, Info.srWindow.Top ); + pState->SavePos = CUR; return; case 'u': // ESC[u Return to saved cursor position if (es_argc != 0) return; - Pos.X = pState->SavePos.X; - Pos.Y = pState->SavePos.Y + TOP; + Pos = pState->SavePos; if (Pos.X > RIGHT) Pos.X = RIGHT; if (Pos.Y > BOTTOM) Pos.Y = BOTTOM; SetConsoleCursorPosition( hConOut, Pos ); diff --git a/ansicon.c b/ansicon.c index 5af2592..83a5572 100644 --- a/ansicon.c +++ b/ansicon.c @@ -87,7 +87,7 @@ add error codes to some message. */ -#define PDATE L"26 October, 2017" +#define PDATE L"28 October, 2017" #include "ansicon.h" #include "version.h" diff --git a/readme.txt b/readme.txt index cb7741c..0af43bc 100644 --- a/readme.txt +++ b/readme.txt @@ -295,8 +295,9 @@ Version History Legend: + added, - bug-fixed, * changed. - 1.80 - 27 October, 2017: - - fix unloading. + 1.80 - 28 October, 2017: + - fix unloading; + * go back to saving the buffer cursor position. 1.72 - 24 December, 2015: - handle STD_OUTPUT_HANDLE & STD_ERROR_HANDLE in WriteFile; @@ -524,4 +525,4 @@ Distribution ============================= -Jason Hood, 27 October, 2017. +Jason Hood, 28 October, 2017.