static void vtp_sgr_bulks(int argc, int *argv);
static int wt_working = 0;
-static void wt_init();
+static void wt_init(void);
static int g_color_index_bg = 0;
static int g_color_index_fg = 7;
static char_u *exe_path = NULL;
static BOOL win8_or_later = FALSE;
+static BOOL win11_or_later = FALSE;
/*
* Get version number including build number
|| ovi.dwMajorVersion > 6)
win8_or_later = TRUE;
+ if ((ovi.dwMajorVersion == 10 && ovi.dwBuildNumber >= 22000)
+ || ovi.dwMajorVersion > 10)
+ win11_or_later = TRUE;
+
#ifdef HAVE_ACL
// Enable privilege for getting or setting SACLs.
win32_enable_privilege(SE_SECURITY_NAME, TRUE);
}
cb->IsValid = TRUE;
+ // VTP uses alternate screen buffer.
+ // No need to save buffer contents for restoration.
+ if (win11_or_later && vtp_working)
+ return TRUE;
+
/*
* Allocate a buffer large enough to hold the entire console screen
* buffer. If this ConsoleBuffer structure has already been initialized
SMALL_RECT WriteRegion;
int i;
+ // VTP uses alternate screen buffer.
+ // No need to restore buffer contents.
+ if (win11_or_later && vtp_working)
+ return TRUE;
+
if (cb == NULL || !cb->IsValid)
return FALSE;
if (g_fTermcapMode)
return;
- if (!p_rs && USE_VTP)
+ // VTP uses alternate screen buffer.
+ // Switch to a new alternate screen buffer.
+ if (win11_or_later && p_rs && vtp_working)
vtp_printf("\033[?1049h");
SaveConsoleBuffer(&g_cbNonTermcap);
# endif
RestoreConsoleBuffer(cb, p_rs);
restore_console_color_rgb();
- SetConsoleCursorInfo(g_hConOut, &g_cci);
- if (p_rs || exiting)
+ // VTP uses alternate screen buffer.
+ // Switch back to main screen buffer.
+ if (exiting && win11_or_later && p_rs && vtp_working)
+ vtp_printf("\033[?1049l");
+
+ if (!USE_WT && (p_rs || exiting))
{
/*
* Clear anything that happens to be on the current line.
*/
coord.X = 0;
coord.Y = (SHORT) (p_rs ? cb->Info.dwCursorPosition.Y : (Rows - 1));
- FillConsoleOutputCharacter(g_hConOut, ' ',
- cb->Info.dwSize.X, coord, &dwDummy);
+ if (!vtp_working)
+ FillConsoleOutputCharacter(g_hConOut, ' ',
+ cb->Info.dwSize.X, coord, &dwDummy);
/*
* The following is just for aesthetics. If we are exiting without
* restoring the screen, then we want to have a prompt string
*/
SetConsoleCursorPosition(g_hConOut, coord);
}
-
- if (!p_rs && USE_VTP)
- vtp_printf("\033[?1049l");
-
+ SetConsoleCursorInfo(g_hConOut, &g_cci);
g_fTermcapMode = FALSE;
}
#endif // !FEAT_GUI_MSWIN || VIMDLL
* Not stable now.
*/
#define CONPTY_STABLE_BUILD MAKE_VER(10, 0, 32767) // T.B.D.
-// Note: Windows 11 (build >= 22000 means Windows 11, even though the major
-// version says 10!)
+// Notes:
+// Win 10 22H2 Final is build 19045, it's conpty is widely used.
+// Strangely, 19045 is newer but is a lower build number than the 2020 insider
+// preview which had a build 19587. And, not sure how stable that was?
+// Win Server 2022 (May 10, 2022) is build 20348, its conpty is widely used.
+// Win 11 starts from build 22000, even though the major version says 10!
static void
vtp_flag_init(void)
static void
wt_init(void)
{
- wt_working = (mch_getenv("WT_SESSION") != NULL);
-}
-
- int
-use_wt(void)
-{
- return USE_WT;
+ wt_working = mch_getenv("WT_SESSION") != NULL;
}
# ifdef FEAT_TERMGUICOLORS