1
0
forked from aniani/vim

patch 8.2.0547: Win32: restoring screen not always done right

Problem:    Win32: restoring screen not always done right.
Solution:   Use a more appropriate method. (Nobuhiro Takasaki, closes #5909)
This commit is contained in:
Bram Moolenaar
2020-04-11 22:38:34 +02:00
parent fe27081724
commit e7f234120f
2 changed files with 15 additions and 7 deletions

View File

@@ -2612,8 +2612,12 @@ mch_init_c(void)
create_conin(); create_conin();
g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE); g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
vtp_flag_init();
# ifdef FEAT_RESTORE_ORIG_SCREEN # ifdef FEAT_RESTORE_ORIG_SCREEN
// Save the initial console buffer for later restoration // Save the initial console buffer for later restoration
if (vtp_working && p_rs)
vtp_printf("\033[?1049h");
SaveConsoleBuffer(&g_cbOrig); SaveConsoleBuffer(&g_cbOrig);
g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes; g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes;
# else # else
@@ -2671,7 +2675,6 @@ mch_init_c(void)
win_clip_init(); win_clip_init();
# endif # endif
vtp_flag_init();
vtp_init(); vtp_init();
} }
@@ -5431,9 +5434,6 @@ termcap_mode_start(void)
if (g_fTermcapMode) if (g_fTermcapMode)
return; return;
if (!p_rs && USE_VTP)
vtp_printf("\033[?1049h");
SaveConsoleBuffer(&g_cbNonTermcap); SaveConsoleBuffer(&g_cbNonTermcap);
if (g_cbTermcap.IsValid) if (g_cbTermcap.IsValid)
@@ -5501,6 +5501,7 @@ termcap_mode_end(void)
# ifdef FEAT_RESTORE_ORIG_SCREEN # ifdef FEAT_RESTORE_ORIG_SCREEN
cb = exiting ? &g_cbOrig : &g_cbNonTermcap; cb = exiting ? &g_cbOrig : &g_cbNonTermcap;
if (!(vtp_working && exiting))
# else # else
cb = &g_cbNonTermcap; cb = &g_cbNonTermcap;
# endif # endif
@@ -5530,11 +5531,16 @@ termcap_mode_end(void)
/* /*
* Position the cursor at the leftmost column of the desired row. * Position the cursor at the leftmost column of the desired row.
*/ */
# ifdef FEAT_RESTORE_ORG_SCREEN
if (!(vtp_working && exiting))
# endif
SetConsoleCursorPosition(g_hConOut, coord); SetConsoleCursorPosition(g_hConOut, coord);
} }
if (!p_rs && USE_VTP) # ifdef FEAT_RESTORE_ORIG_SCREEN
if (vtp_working && p_rs && exiting)
vtp_printf("\033[?1049l"); vtp_printf("\033[?1049l");
# endif
g_fTermcapMode = FALSE; g_fTermcapMode = FALSE;
} }

View File

@@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
547,
/**/ /**/
546, 546,
/**/ /**/