summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0338
blob: b8de0abfa0bd0183e6ad5432948178794a61e23c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0338
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0338
Problem:    MS-Windows: VTP doesn't work properly with Powershell.
Solution:   Adjust the color index. (Nobuhiro Takasaki, closes #3347)
Files:	    src/os_win32.c


*** ../vim-8.1.0337/src/os_win32.c	2018-08-23 22:38:27.915001621 +0200
--- src/os_win32.c	2018-08-30 17:45:38.582500357 +0200
***************
*** 213,218 ****
--- 213,226 ----
  static guicolor_T save_console_bg_rgb;
  static guicolor_T save_console_fg_rgb;
  
+ static int g_color_index_bg = 0;
+ 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
+ 
  # ifdef FEAT_TERMGUICOLORS
  #  define USE_VTP		(vtp_working && is_term_win32() && (p_tgc || (!p_tgc && t_colors >= 256)))
  # else
***************
*** 2628,2633 ****
--- 2636,2645 ----
      if (cterm_normal_bg_color == 0)
  	cterm_normal_bg_color = ((g_attrCurrent >> 4) & 0xf) + 1;
  
+     // Fg and Bg color index nunmber at startup
+     g_color_index_fg = g_attrDefault & 0xf;
+     g_color_index_bg = (g_attrDefault >> 4) & 0xf;
+ 
      /* set termcap codes to current text attributes */
      update_tcap(g_attrCurrent);
  
***************
*** 7664,7669 ****
--- 7676,7684 ----
      DWORD   ver, mode;
      HMODULE hKerneldll;
      DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi;
+ # ifdef FEAT_TERMGUICOLORS
+     COLORREF fg, bg;
+ # endif
  
      ver = get_build_number();
      vtp_working = (ver >= VTP_FIRST_SUPPORT_BUILD) ? 1 : 0;
***************
*** 7690,7697 ****
      csbi.cbSize = sizeof(csbi);
      if (has_csbiex)
  	pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
!     save_console_bg_rgb = (guicolor_T)csbi.ColorTable[0];
!     save_console_fg_rgb = (guicolor_T)csbi.ColorTable[7];
  
      set_console_color_rgb();
  }
--- 7705,7721 ----
      csbi.cbSize = sizeof(csbi);
      if (has_csbiex)
  	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];
! 
! # 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
  
      set_console_color_rgb();
  }
***************
*** 7788,7801 ****
  	ctermfg = -1;
  	if (id > 0)
  	    syn_id2cterm_bg(id, &ctermfg, &ctermbg);
! 	fg = ctermfg != -1 ? ctermtoxterm(ctermfg) : 0xc0c0c0; /* white */
      }
      if (bg == INVALCOLOR)
      {
  	ctermbg = -1;
  	if (id > 0)
  	    syn_id2cterm_bg(id, &ctermfg, &ctermbg);
! 	bg = ctermbg != -1 ? ctermtoxterm(ctermbg) : 0x000000; /* black */
      }
      fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
      bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
--- 7812,7827 ----
  	ctermfg = -1;
  	if (id > 0)
  	    syn_id2cterm_bg(id, &ctermfg, &ctermbg);
! 	fg = ctermfg != -1 ? ctermtoxterm(ctermfg) : default_console_color_fg;
! 	cterm_normal_fg_gui_color = fg;
      }
      if (bg == INVALCOLOR)
      {
  	ctermbg = -1;
  	if (id > 0)
  	    syn_id2cterm_bg(id, &ctermfg, &ctermbg);
! 	bg = ctermbg != -1 ? ctermtoxterm(ctermbg) : default_console_color_bg;
! 	cterm_normal_bg_gui_color = bg;
      }
      fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg);
      bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg);
***************
*** 7807,7814 ****
      csbi.cbSize = sizeof(csbi);
      csbi.srWindow.Right += 1;
      csbi.srWindow.Bottom += 1;
!     csbi.ColorTable[0] = (COLORREF)bg;
!     csbi.ColorTable[7] = (COLORREF)fg;
      if (has_csbiex)
  	pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
  # endif
--- 7833,7840 ----
      csbi.cbSize = sizeof(csbi);
      csbi.srWindow.Right += 1;
      csbi.srWindow.Bottom += 1;
!     csbi.ColorTable[g_color_index_bg] = (COLORREF)bg;
!     csbi.ColorTable[g_color_index_fg] = (COLORREF)fg;
      if (has_csbiex)
  	pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
  # endif
***************
*** 7827,7834 ****
      csbi.cbSize = sizeof(csbi);
      csbi.srWindow.Right += 1;
      csbi.srWindow.Bottom += 1;
!     csbi.ColorTable[0] = (COLORREF)save_console_bg_rgb;
!     csbi.ColorTable[7] = (COLORREF)save_console_fg_rgb;
      if (has_csbiex)
  	pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
  # endif
--- 7853,7860 ----
      csbi.cbSize = sizeof(csbi);
      csbi.srWindow.Right += 1;
      csbi.srWindow.Bottom += 1;
!     csbi.ColorTable[g_color_index_bg] = (COLORREF)save_console_bg_rgb;
!     csbi.ColorTable[g_color_index_fg] = (COLORREF)save_console_fg_rgb;
      if (has_csbiex)
  	pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi);
  # endif
*** ../vim-8.1.0337/src/version.c	2018-08-30 15:58:23.248944510 +0200
--- src/version.c	2018-08-30 17:45:48.250391370 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     338,
  /**/

-- 
The average life of an organization chart is six months.  You can safely
ignore any order from your boss that would take six months to complete.
				(Scott Adams - The Dilbert principle)

 /// 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    ///