Patch 9.0.1232
Problem: ColorTable saving and restoring does not work properly.
Solution: Restore ColorTable[16] usage. (Christopher Plewright,
closes #11836)
Files: src/os_win32.c, src/proto/os_win32.pro, src/term.c
*** ../vim-9.0.1231/src/os_win32.c 2023-01-16 18:19:01.911301085 +0000
--- src/os_win32.c 2023-01-22 18:54:34.742797460 +0000
***************
*** 3426,3432 ****
wt_init();
vtp_flag_init();
- vtp_init();
# ifdef FEAT_RESTORE_ORIG_SCREEN
// Save the initial console buffer for later restoration
SaveConsoleBuffer(&g_cbOrig);
--- 3426,3431 ----
***************
*** 3463,3468 ****
--- 3462,3469 ----
ui_get_shellsize();
+ vtp_init();
+
# ifdef MCH_WRITE_DUMP
fdDump = fopen("dump", "wt");
***************
*** 8456,8481 ****
vtp_init(void)
{
# ifdef FEAT_TERMGUICOLORS
! if (!vtp_working)
! {
! CONSOLE_SCREEN_BUFFER_INFOEX csbi;
! csbi.cbSize = sizeof(csbi);
! GetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
! save_console_bg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_bg];
! 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;
!
! COLORREF bg;
! bg = (COLORREF)csbi.ColorTable[g_color_index_bg];
! bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
! default_console_color_bg = bg;
!
! COLORREF fg;
! fg = (COLORREF)csbi.ColorTable[g_color_index_fg];
! fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
! default_console_color_fg = fg;
! }
# endif
use_alternate_screen_buffer = win10_22H2_or_later && p_rs && vtp_working
&& !mch_getenv("VIM_TERMINAL");
--- 8457,8479 ----
vtp_init(void)
{
# ifdef FEAT_TERMGUICOLORS
! CONSOLE_SCREEN_BUFFER_INFOEX csbi;
! csbi.cbSize = sizeof(csbi);
! GetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
! save_console_bg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_bg];
! 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;
!
! COLORREF bg;
! bg = (COLORREF)csbi.ColorTable[g_color_index_bg];
! bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
! default_console_color_bg = bg;
!
! COLORREF fg;
! fg = (COLORREF)csbi.ColorTable[g_color_index_fg];
! fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
! default_console_color_fg = fg;
# endif
use_alternate_screen_buffer = win10_22H2_or_later && p_rs && vtp_working
&& !mch_getenv("VIM_TERMINAL");
***************
*** 8667,8672 ****
--- 8665,8676 ----
wt_working = mch_getenv("WT_SESSION") != NULL;
}
+ int
+ use_wt(void)
+ {
+ return USE_WT;
+ }
+
# ifdef FEAT_TERMGUICOLORS
static int
ctermtoxterm(
***************
*** 8699,8721 ****
return;
}
! if (!conpty_working)
! {
! fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
! bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
! csbi.cbSize = sizeof(csbi);
! GetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
! csbi.cbSize = sizeof(csbi);
! csbi.srWindow.Right += 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_fg] = (COLORREF)fg;
! SetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
! }
# endif
}
--- 8703,8722 ----
return;
}
! fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
! bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
! csbi.cbSize = sizeof(csbi);
! GetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
! csbi.cbSize = sizeof(csbi);
! csbi.srWindow.Right += 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_fg] = (COLORREF)fg;
! SetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
# endif
}
***************
*** 8742,8780 ****
ctermfg = -1;
if (id > 0)
syn_id2cterm_bg(id, &ctermfg, &dummynull);
! if (vtp_working)
! {
! cterm_normal_fg_gui_color = guifg =
! ctermfg != -1 ? ctermtoxterm(ctermfg) : INVALCOLOR;
! ctermfg = ctermfg < 0 ? 0 : ctermfg;
! }
else
! {
! guifg = ctermfg != -1 ? ctermtoxterm(ctermfg)
! : default_console_color_fg;
! cterm_normal_fg_gui_color = guifg;
! ctermfg = ctermfg < 0 ? 0 : ctermfg;
! }
}
if (guibg == INVALCOLOR)
{
ctermbg = -1;
if (id > 0)
syn_id2cterm_bg(id, &dummynull, &ctermbg);
! if (vtp_working)
! {
! cterm_normal_bg_gui_color = guibg =
! ctermbg != -1 ? ctermtoxterm(ctermbg) : INVALCOLOR;
! if (ctermbg < 0)
! ctermbg = 0;
! }
else
! {
! guibg = ctermbg != -1 ? ctermtoxterm(ctermbg)
! : default_console_color_bg;
! cterm_normal_bg_gui_color = guibg;
! ctermbg = ctermbg < 0 ? 0 : ctermbg;
! }
}
*cterm_fg = ctermfg;
--- 8743,8766 ----
ctermfg = -1;
if (id > 0)
syn_id2cterm_bg(id, &ctermfg, &dummynull);
! if (ctermfg != -1)
! guifg = ctermtoxterm(ctermfg);
else
! guifg = USE_WT ? INVALCOLOR : default_console_color_fg;
! cterm_normal_fg_gui_color = guifg;
! ctermfg = ctermfg < 0 ? 0 : ctermfg;
}
if (guibg == INVALCOLOR)
{
ctermbg = -1;
if (id > 0)
syn_id2cterm_bg(id, &dummynull, &ctermbg);
! if (ctermbg != -1)
! guibg = ctermtoxterm(ctermbg);
else
! guibg = USE_WT ? INVALCOLOR : default_console_color_bg;
! cterm_normal_bg_gui_color = guibg;
! ctermbg = ctermbg < 0 ? 0 : ctermbg;
}
*cterm_fg = ctermfg;
***************
*** 8792,8800 ****
{
# ifdef FEAT_TERMGUICOLORS
- if (vtp_working)
- return;
-
CONSOLE_SCREEN_BUFFER_INFOEX csbi;
csbi.cbSize = sizeof(csbi);
--- 8778,8783 ----
***************
*** 8816,8823 ****
restore_console_color_rgb(void)
{
# ifdef FEAT_TERMGUICOLORS
- if (vtp_working)
- return;
CONSOLE_SCREEN_BUFFER_INFOEX csbi;
--- 8799,8804 ----
*** ../vim-9.0.1231/src/proto/os_win32.pro 2022-12-20 20:01:09.624090908
+0000
--- src/proto/os_win32.pro 2023-01-22 18:56:37.614840611 +0000
***************
*** 73,78 ****
--- 73,79 ----
void fix_arg_enc(void);
int mch_setenv(char *var, char *value, int x);
int vtp_printf(char *format, ...);
+ int use_wt(void);
void get_default_console_color(int *cterm_fg, int *cterm_bg, guicolor_T
*gui_fg, guicolor_T *gui_bg);
void control_console_color_rgb(void);
int use_vtp(void);
*** ../vim-9.0.1231/src/term.c 2023-01-18 17:20:20.863136716 +0000
--- src/term.c 2023-01-22 18:54:34.742797460 +0000
***************
*** 3222,3228 ****
vim_snprintf(buf, MAX_COLOR_STR_LEN,
(char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
#ifdef FEAT_VTP
! if (has_vtp_working())
{
out_flush();
buf[1] = '[';
--- 3222,3228 ----
vim_snprintf(buf, MAX_COLOR_STR_LEN,
(char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
#ifdef FEAT_VTP
! if (use_wt())
{
out_flush();
buf[1] = '[';
*** ../vim-9.0.1231/src/version.c 2023-01-22 18:38:45.502261340 +0000
--- src/version.c 2023-01-22 18:56:27.990837456 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1232,
/**/
--
Seen it all, done it all, can't remember most of it.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230122185906.666E21C0548%40moolenaar.net.