To: vim_dev@googlegroups.com Subject: Patch 9.0.0344 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0344 Problem: MS-Windows: background color wrong in Console. Solution: Figure out the default console background color. (Yasuhiro Matsumoto, issue #10310) Files: src/os_win32.c *** ../vim-9.0.0343/src/os_win32.c 2022-08-14 14:16:07.999582175 +0100 --- src/os_win32.c 2022-09-01 11:29:19.003096553 +0100 *************** *** 213,218 **** --- 213,219 ---- static int g_color_index_fg = 7; # ifdef FEAT_TERMGUICOLORS + static int default_console_color_bg = 0x000000; // black static int default_console_color_fg = 0xc0c0c0; // white # endif *************** *** 7878,7883 **** --- 7879,7891 ---- store_console_fg_rgb = save_console_fg_rgb; # ifdef FEAT_TERMGUICOLORS + if (!USE_WT) + { + COLORREF bg; + bg = (COLORREF)csbi.ColorTable[g_color_index_bg]; + bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg); + default_console_color_bg = bg; + } fg = (COLORREF)csbi.ColorTable[g_color_index_fg]; fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg); default_console_color_fg = fg; *************** *** 8160,8170 **** ctermbg = -1; if (id > 0) syn_id2cterm_bg(id, &ctermfg, &ctermbg); ! cterm_normal_bg_gui_color = guibg = ctermbg != -1 ? ctermtoxterm(ctermbg) : INVALCOLOR; ! ! if (ctermbg < 0) ! ctermbg = 0; } *cterm_fg = ctermfg; --- 8168,8187 ---- ctermbg = -1; if (id > 0) syn_id2cterm_bg(id, &ctermfg, &ctermbg); ! if (!USE_WT) ! { ! guibg = ctermbg != -1 ? ctermtoxterm(ctermbg) ! : default_console_color_bg; ! cterm_normal_bg_gui_color = guibg; ! ctermbg = ctermbg < 0 ? 0 : ctermbg; ! } ! else ! { ! cterm_normal_bg_gui_color = guibg = ctermbg != -1 ? ctermtoxterm(ctermbg) : INVALCOLOR; ! if (ctermbg < 0) ! ctermbg = 0; ! } } *cterm_fg = ctermfg; *** ../vim-9.0.0343/src/version.c 2022-08-31 21:17:06.461695535 +0100 --- src/version.c 2022-09-01 11:27:31.567057289 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 344, /**/ -- ARTHUR: You are indeed brave Sir knight, but the fight is mine. BLACK KNIGHT: Had enough? ARTHUR: You stupid bastard. You havn't got any arms left. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///