forked from aniani/vim
patch 8.2.0178: with VTP the screen may not be restored properly
Problem: With VTP the screen may not be restored properly. Solution: Add another set of saved RGB values. (Nobuhiro Takasaki, closes #5548)
This commit is contained in:
@@ -200,6 +200,8 @@ static void vtp_sgr_bulks(int argc, int *argv);
|
|||||||
|
|
||||||
static guicolor_T save_console_bg_rgb;
|
static guicolor_T save_console_bg_rgb;
|
||||||
static guicolor_T save_console_fg_rgb;
|
static guicolor_T save_console_fg_rgb;
|
||||||
|
static guicolor_T store_console_bg_rgb;
|
||||||
|
static guicolor_T store_console_fg_rgb;
|
||||||
|
|
||||||
static int g_color_index_bg = 0;
|
static int g_color_index_bg = 0;
|
||||||
static int g_color_index_fg = 7;
|
static int g_color_index_fg = 7;
|
||||||
@@ -217,6 +219,7 @@ static int default_console_color_fg = 0xc0c0c0; // white
|
|||||||
|
|
||||||
static void set_console_color_rgb(void);
|
static void set_console_color_rgb(void);
|
||||||
static void reset_console_color_rgb(void);
|
static void reset_console_color_rgb(void);
|
||||||
|
static void restore_console_color_rgb(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This flag is newly created from Windows 10
|
// This flag is newly created from Windows 10
|
||||||
@@ -5496,7 +5499,7 @@ termcap_mode_end(void)
|
|||||||
cb = &g_cbNonTermcap;
|
cb = &g_cbNonTermcap;
|
||||||
# endif
|
# endif
|
||||||
RestoreConsoleBuffer(cb, p_rs);
|
RestoreConsoleBuffer(cb, p_rs);
|
||||||
reset_console_color_rgb();
|
restore_console_color_rgb();
|
||||||
SetConsoleCursorInfo(g_hConOut, &g_cci);
|
SetConsoleCursorInfo(g_hConOut, &g_cci);
|
||||||
|
|
||||||
if (p_rs || exiting)
|
if (p_rs || exiting)
|
||||||
@@ -7327,6 +7330,8 @@ vtp_init(void)
|
|||||||
pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
||||||
save_console_bg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_bg];
|
save_console_bg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_bg];
|
||||||
save_console_fg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_fg];
|
save_console_fg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_fg];
|
||||||
|
store_console_bg_rgb = save_console_bg_rgb;
|
||||||
|
store_console_fg_rgb = save_console_fg_rgb;
|
||||||
|
|
||||||
# ifdef FEAT_TERMGUICOLORS
|
# ifdef FEAT_TERMGUICOLORS
|
||||||
bg = (COLORREF)csbi.ColorTable[g_color_index_bg];
|
bg = (COLORREF)csbi.ColorTable[g_color_index_bg];
|
||||||
@@ -7343,7 +7348,7 @@ vtp_init(void)
|
|||||||
static void
|
static void
|
||||||
vtp_exit(void)
|
vtp_exit(void)
|
||||||
{
|
{
|
||||||
reset_console_color_rgb();
|
restore_console_color_rgb();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -7433,6 +7438,8 @@ set_console_color_rgb(void)
|
|||||||
csbi.cbSize = sizeof(csbi);
|
csbi.cbSize = sizeof(csbi);
|
||||||
csbi.srWindow.Right += 1;
|
csbi.srWindow.Right += 1;
|
||||||
csbi.srWindow.Bottom += 1;
|
csbi.srWindow.Bottom += 1;
|
||||||
|
store_console_bg_rgb = csbi.ColorTable[g_color_index_bg];
|
||||||
|
store_console_fg_rgb = csbi.ColorTable[g_color_index_fg];
|
||||||
csbi.ColorTable[g_color_index_bg] = (COLORREF)bg;
|
csbi.ColorTable[g_color_index_bg] = (COLORREF)bg;
|
||||||
csbi.ColorTable[g_color_index_fg] = (COLORREF)fg;
|
csbi.ColorTable[g_color_index_fg] = (COLORREF)fg;
|
||||||
if (has_csbiex)
|
if (has_csbiex)
|
||||||
@@ -7485,12 +7492,38 @@ get_default_console_color(
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the console colors to the original colors or the last set colors.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
reset_console_color_rgb(void)
|
reset_console_color_rgb(void)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_TERMGUICOLORS
|
# ifdef FEAT_TERMGUICOLORS
|
||||||
DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
|
DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
|
||||||
|
|
||||||
|
csbi.cbSize = sizeof(csbi);
|
||||||
|
if (has_csbiex)
|
||||||
|
pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
||||||
|
|
||||||
|
csbi.cbSize = sizeof(csbi);
|
||||||
|
csbi.srWindow.Right += 1;
|
||||||
|
csbi.srWindow.Bottom += 1;
|
||||||
|
csbi.ColorTable[g_color_index_bg] = (COLORREF)store_console_bg_rgb;
|
||||||
|
csbi.ColorTable[g_color_index_fg] = (COLORREF)store_console_fg_rgb;
|
||||||
|
if (has_csbiex)
|
||||||
|
pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the console colors to the original colors.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
restore_console_color_rgb(void)
|
||||||
|
{
|
||||||
|
# ifdef FEAT_TERMGUICOLORS
|
||||||
|
DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
|
||||||
|
|
||||||
csbi.cbSize = sizeof(csbi);
|
csbi.cbSize = sizeof(csbi);
|
||||||
if (has_csbiex)
|
if (has_csbiex)
|
||||||
pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
|
||||||
|
@@ -742,6 +742,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 */
|
||||||
|
/**/
|
||||||
|
178,
|
||||||
/**/
|
/**/
|
||||||
177,
|
177,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user