diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-11 22:38:34 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-11 22:38:34 +0200 |
commit | e7f234120f71a75f0c7c2a67e0b70c6450c50a02 (patch) | |
tree | 74e58321e68e1fe5d27576823a40df3a5aaaf8a9 | |
parent | fe270817247b73a9315bb10f0a51b6eca406d300 (diff) | |
download | vim-git-e7f234120f71a75f0c7c2a67e0b70c6450c50a02.tar.gz |
patch 8.2.0547: Win32: restoring screen not always done rightv8.2.0547
Problem: Win32: restoring screen not always done right.
Solution: Use a more appropriate method. (Nobuhiro Takasaki, closes #5909)
-rw-r--r-- | src/os_win32.c | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index 77e43d5d3..a7a8ad1cf 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2612,8 +2612,12 @@ mch_init_c(void) create_conin(); g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE); + vtp_flag_init(); + # ifdef FEAT_RESTORE_ORIG_SCREEN // Save the initial console buffer for later restoration + if (vtp_working && p_rs) + vtp_printf("\033[?1049h"); SaveConsoleBuffer(&g_cbOrig); g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes; # else @@ -2671,7 +2675,6 @@ mch_init_c(void) win_clip_init(); # endif - vtp_flag_init(); vtp_init(); } @@ -5431,9 +5434,6 @@ termcap_mode_start(void) if (g_fTermcapMode) return; - if (!p_rs && USE_VTP) - vtp_printf("\033[?1049h"); - SaveConsoleBuffer(&g_cbNonTermcap); if (g_cbTermcap.IsValid) @@ -5501,10 +5501,11 @@ termcap_mode_end(void) # ifdef FEAT_RESTORE_ORIG_SCREEN cb = exiting ? &g_cbOrig : &g_cbNonTermcap; + if (!(vtp_working && exiting)) # else cb = &g_cbNonTermcap; # endif - RestoreConsoleBuffer(cb, p_rs); + RestoreConsoleBuffer(cb, p_rs); restore_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); @@ -5530,11 +5531,16 @@ termcap_mode_end(void) /* * Position the cursor at the leftmost column of the desired row. */ - SetConsoleCursorPosition(g_hConOut, coord); +# ifdef FEAT_RESTORE_ORG_SCREEN + if (!(vtp_working && exiting)) +# endif + SetConsoleCursorPosition(g_hConOut, coord); } - if (!p_rs && USE_VTP) +# ifdef FEAT_RESTORE_ORIG_SCREEN + if (vtp_working && p_rs && exiting) vtp_printf("\033[?1049l"); +# endif g_fTermcapMode = FALSE; } diff --git a/src/version.c b/src/version.c index 2d1d2f9a2..22b00e4dc 100644 --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 547, +/**/ 546, /**/ 545, |