To: vim_dev@googlegroups.com Subject: Patch 8.2.0178 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0178 Problem: With VTP the screen may not be restored properly. Solution: Add another set of saved RGB values. (Nobuhiro Takasaki, closes #5548) Files: src/os_win32.c *** ../vim-8.2.0177/src/os_win32.c 2020-01-26 21:59:25.628718127 +0100 --- src/os_win32.c 2020-01-30 11:53:15.746586193 +0100 *************** *** 200,205 **** --- 200,207 ---- static guicolor_T save_console_bg_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_fg = 7; *************** *** 217,222 **** --- 219,225 ---- static void set_console_color_rgb(void); static void reset_console_color_rgb(void); + static void restore_console_color_rgb(void); #endif // This flag is newly created from Windows 10 *************** *** 5496,5502 **** cb = &g_cbNonTermcap; # endif RestoreConsoleBuffer(cb, p_rs); ! reset_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); if (p_rs || exiting) --- 5499,5505 ---- cb = &g_cbNonTermcap; # endif RestoreConsoleBuffer(cb, p_rs); ! restore_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); if (p_rs || exiting) *************** *** 7327,7332 **** --- 7330,7337 ---- pGetConsoleScreenBufferInfoEx(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; # ifdef FEAT_TERMGUICOLORS bg = (COLORREF)csbi.ColorTable[g_color_index_bg]; *************** *** 7343,7349 **** static void vtp_exit(void) { ! reset_console_color_rgb(); } static int --- 7348,7354 ---- static void vtp_exit(void) { ! restore_console_color_rgb(); } static int *************** *** 7433,7438 **** --- 7438,7445 ---- 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; if (has_csbiex) *************** *** 7485,7495 **** --- 7492,7528 ---- } # endif + /* + * Set the console colors to the original colors or the last set colors. + */ static void reset_console_color_rgb(void) { # ifdef FEAT_TERMGUICOLORS 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); if (has_csbiex) *** ../vim-8.2.0177/src/version.c 2020-01-29 22:38:41.848961650 +0100 --- src/version.c 2020-01-30 11:51:20.982962194 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 178, /**/ -- hundred-and-one symptoms of being an internet addict: 17. You turn on your intercom when leaving the room so you can hear if new e-mail arrives. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///