mirror of
https://github.com/vim/vim.git
synced 2025-09-07 22:03:36 -04:00
patch 9.0.1086: display wrong in Windows terminal after exiting Vim
Problem: Display wrong in Windows terminal after exiting Vim. Solution: Apply screen restore fix for Windows 11 also to Windows 10 builds. (Christopher Plewright, closes #11713, closes #11706)
This commit is contained in:
parent
9b8a365d01
commit
c8b126d70d
@ -256,7 +256,8 @@ static int suppress_winsize = 1; // don't fiddle with console
|
||||
static char_u *exe_path = NULL;
|
||||
|
||||
static BOOL win8_or_later = FALSE;
|
||||
static BOOL win11_or_later = FALSE;
|
||||
static BOOL win10_22H2_or_later = FALSE;
|
||||
static BOOL use_alternate_screen_buffer = FALSE;
|
||||
|
||||
/*
|
||||
* Get version number including build number
|
||||
@ -919,9 +920,9 @@ PlatformId(void)
|
||||
|| ovi.dwMajorVersion > 6)
|
||||
win8_or_later = TRUE;
|
||||
|
||||
if ((ovi.dwMajorVersion == 10 && ovi.dwBuildNumber >= 22000)
|
||||
if ((ovi.dwMajorVersion == 10 && ovi.dwBuildNumber >= 19045)
|
||||
|| ovi.dwMajorVersion > 10)
|
||||
win11_or_later = TRUE;
|
||||
win10_22H2_or_later = TRUE;
|
||||
|
||||
#ifdef HAVE_ACL
|
||||
// Enable privilege for getting or setting SACLs.
|
||||
@ -3040,7 +3041,7 @@ SaveConsoleBuffer(
|
||||
|
||||
// VTP uses alternate screen buffer.
|
||||
// No need to save buffer contents for restoration.
|
||||
if (win11_or_later && vtp_working)
|
||||
if (use_alternate_screen_buffer)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
@ -3138,7 +3139,7 @@ RestoreConsoleBuffer(
|
||||
|
||||
// VTP uses alternate screen buffer.
|
||||
// No need to restore buffer contents.
|
||||
if (win11_or_later && vtp_working)
|
||||
if (use_alternate_screen_buffer)
|
||||
return TRUE;
|
||||
|
||||
if (cb == NULL || !cb->IsValid)
|
||||
@ -6106,7 +6107,8 @@ termcap_mode_start(void)
|
||||
|
||||
// VTP uses alternate screen buffer.
|
||||
// Switch to a new alternate screen buffer.
|
||||
if (win11_or_later && p_rs && vtp_working)
|
||||
// But, not if running in a nested terminal
|
||||
if (use_alternate_screen_buffer)
|
||||
vtp_printf("\033[?1049h");
|
||||
|
||||
SaveConsoleBuffer(&g_cbNonTermcap);
|
||||
@ -6189,7 +6191,7 @@ termcap_mode_end(void)
|
||||
|
||||
// VTP uses alternate screen buffer.
|
||||
// Switch back to main screen buffer.
|
||||
if (exiting && win11_or_later && p_rs && vtp_working)
|
||||
if (exiting && use_alternate_screen_buffer)
|
||||
vtp_printf("\033[?1049l");
|
||||
|
||||
if (!USE_WT && (p_rs || exiting))
|
||||
@ -8392,7 +8394,8 @@ vtp_init(void)
|
||||
default_console_color_fg = fg;
|
||||
}
|
||||
# endif
|
||||
|
||||
use_alternate_screen_buffer = win10_22H2_or_later && p_rs && vtp_working
|
||||
&& !mch_getenv("VIM_TERMINAL");
|
||||
set_console_color_rgb();
|
||||
}
|
||||
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1086,
|
||||
/**/
|
||||
1085,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user