Patch 8.2.4906
Problem:    MS-Windows: cannot use transparent background.
Solution:   Make transparent background work with 'termguicolors' and NONE
            background color. (Yasuhiro Matsumoto, closes #10310, closes #7162)
Files:      runtime/doc/options.txt, src/os_win32.c, src/term.c


*** ../vim-8.2.4905/runtime/doc/options.txt     2022-05-06 12:15:33.860427761 
+0100
--- runtime/doc/options.txt     2022-05-07 14:06:24.704897223 +0100
***************
*** 8045,8050 ****
--- 8079,8091 ----
  <     This requires Vim to be built with the |+vtp| feature.
  
        Note that the "cterm" attributes are still used, not the "gui" ones.
+ 
+       When using Vim with Windows Terminal, the background of Windows
+       Terminal is normally filled with the Vim background color.  Setting
+       'termguicolors' and the guibg of the Normal highlight group to NONE
+       will make the background transparent: >
+               :hi Normal guibg=NONE
+ <
        NOTE: This option is reset when 'compatible' is set.
  
                                                *'termwinkey'* *'twk'*
*** ../vim-8.2.4905/src/os_win32.c      2022-05-05 20:18:12.404138485 +0100
--- src/os_win32.c      2022-05-07 14:08:10.864870100 +0100
***************
*** 211,217 ****
  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
  
--- 211,216 ----
***************
*** 7846,7852 ****
      HMODULE hKerneldll;
      DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
  # ifdef FEAT_TERMGUICOLORS
!     COLORREF fg, bg;
  # endif
  
      // Use functions supported from Vista
--- 7845,7851 ----
      HMODULE hKerneldll;
      DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
  # ifdef FEAT_TERMGUICOLORS
!     COLORREF fg;
  # endif
  
      // Use functions supported from Vista
***************
*** 7873,7883 ****
      store_console_fg_rgb = save_console_fg_rgb;
  
  # ifdef FEAT_TERMGUICOLORS
-     bg = (COLORREF)csbi.ColorTable[g_color_index_bg];
      fg = (COLORREF)csbi.ColorTable[g_color_index_fg];
-     bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
      fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
-     default_console_color_bg = bg;
      default_console_color_fg = fg;
  # endif
  
--- 7872,7879 ----
***************
*** 8158,8167 ****
        ctermbg = -1;
        if (id > 0)
            syn_id2cterm_bg(id, &ctermfg, &ctermbg);
!       guibg = ctermbg != -1 ? ctermtoxterm(ctermbg)
!                                                   : default_console_color_bg;
!       cterm_normal_bg_gui_color = guibg;
!       ctermbg = ctermbg < 0 ? 0 : ctermbg;
      }
  
      *cterm_fg = ctermfg;
--- 8154,8164 ----
        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;
*** ../vim-8.2.4905/src/term.c  2022-05-06 18:38:37.111605790 +0100
--- src/term.c  2022-05-07 14:00:56.064964074 +0100
***************
*** 3084,3090 ****
      void
  term_bg_rgb_color(guicolor_T rgb)
  {
!     term_rgb_color(T_8B, rgb);
  }
  
      void
--- 3084,3091 ----
      void
  term_bg_rgb_color(guicolor_T rgb)
  {
!     if (rgb != INVALCOLOR)
!       term_rgb_color(T_8B, rgb);
  }
  
      void
*** ../vim-8.2.4905/src/version.c       2022-05-07 13:25:33.640869382 +0100
--- src/version.c       2022-05-07 14:04:11.736927846 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4906,
  /**/

-- 
Statistics say that you can have a baby per month on average:
Just get nine women pregnant.

 /// 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/20220507131114.DA9EE1C0463%40moolenaar.net.

Raspunde prin e-mail lui