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
|| 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.
// 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;
/*
// 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)
// 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);
// 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))
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();
}