summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0933
blob: 693c1793372c6c2ffae42d2e23f2b1764e8a2869 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0933
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.0933
Problem:    When using VTP scroll region isn't used properly.
Solution:   Make better use of the scroll region. (Nobuhiro Takasaki,
            closes #3974)
Files:	    src/os_win32.c, src/term.c


*** ../vim-8.1.0932/src/os_win32.c	2019-02-16 14:07:34.326138106 +0100
--- src/os_win32.c	2019-02-16 16:44:59.511679299 +0100
***************
*** 171,176 ****
--- 171,179 ----
  static void scroll(unsigned cLines);
  static void set_scroll_region(unsigned left, unsigned top,
  			      unsigned right, unsigned bottom);
+ static void set_scroll_region_tb(unsigned top, unsigned bottom);
+ static void set_scroll_region_lr(unsigned left, unsigned right);
+ static void insert_lines(unsigned cLines);
  static void delete_lines(unsigned cLines);
  static void gotoxy(unsigned x, unsigned y);
  static void standout(void);
***************
*** 5392,5398 ****
  
      if (handles[0] == INVALID_HANDLE_VALUE)
      {
!         CloseHandle(handles[1]);
  	return FALSE;
      }
  
--- 5395,5401 ----
  
      if (handles[0] == INVALID_HANDLE_VALUE)
      {
! 	CloseHandle(handles[1]);
  	return FALSE;
      }
  
***************
*** 5976,5984 ****
      g_srScrollRegion.Top =    top;
      g_srScrollRegion.Right =  right;
      g_srScrollRegion.Bottom = bottom;
  
!     if (USE_VTP)
! 	vtp_printf("\033[%d;%dr", top + 1, bottom + 1);
  }
  
  
--- 5979,6008 ----
      g_srScrollRegion.Top =    top;
      g_srScrollRegion.Right =  right;
      g_srScrollRegion.Bottom = bottom;
+ }
+ 
+     static void
+ set_scroll_region_tb(
+     unsigned top,
+     unsigned bottom)
+ {
+     if (top >= bottom || bottom > (unsigned)Rows - 1)
+ 	return;
  
!     g_srScrollRegion.Top = top;
!     g_srScrollRegion.Bottom = bottom;
! }
! 
!     static void
! set_scroll_region_lr(
!     unsigned left,
!     unsigned right)
! {
!     if (left >= right || right > (unsigned)Columns - 1)
! 	return;
! 
!     g_srScrollRegion.Left = left;
!     g_srScrollRegion.Right = right;
  }
  
  
***************
*** 5988,6034 ****
      static void
  insert_lines(unsigned cLines)
  {
!     SMALL_RECT	    source;
      COORD	    dest;
      CHAR_INFO	    fill;
  
!     dest.X = 0;
      dest.Y = g_coord.Y + cLines;
  
!     source.Left   = 0;
      source.Top	  = g_coord.Y;
      source.Right  = g_srScrollRegion.Right;
      source.Bottom = g_srScrollRegion.Bottom - cLines;
  
!     if (!USE_VTP)
      {
  	fill.Char.AsciiChar = ' ';
! 	fill.Attributes = g_attrCurrent;
  
- 	ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill);
-     }
-     else
-     {
  	set_console_color_rgb();
  
! 	gotoxy(1, source.Top + 1);
! 	vtp_printf("\033[%dT", cLines);
      }
! 
!     /* Here we have to deal with a win32 console flake: If the scroll
!      * region looks like abc and we scroll c to a and fill with d we get
!      * cbd... if we scroll block c one line at a time to a, we get cdd...
!      * vim expects cdd consistently... So we have to deal with that
!      * here... (this also occurs scrolling the same way in the other
!      * direction).  */
  
      if (source.Bottom < dest.Y)
      {
  	COORD coord;
  
! 	coord.X = 0;
! 	coord.Y = source.Bottom;
! 	clear_chars(coord, Columns * (dest.Y - source.Bottom));
      }
  }
  
--- 6012,6060 ----
      static void
  insert_lines(unsigned cLines)
  {
!     SMALL_RECT	    source, clip;
      COORD	    dest;
      CHAR_INFO	    fill;
  
!     dest.X = g_srScrollRegion.Left;
      dest.Y = g_coord.Y + cLines;
  
!     source.Left   = g_srScrollRegion.Left;
      source.Top	  = g_coord.Y;
      source.Right  = g_srScrollRegion.Right;
      source.Bottom = g_srScrollRegion.Bottom - cLines;
  
!     clip.Left   = g_srScrollRegion.Left;
!     clip.Top    = g_coord.Y;
!     clip.Right  = g_srScrollRegion.Right;
!     clip.Bottom = g_srScrollRegion.Bottom;
! 
      {
  	fill.Char.AsciiChar = ' ';
! 	fill.Attributes = g_attrDefault;
  
  	set_console_color_rgb();
  
! 	ScrollConsoleScreenBuffer(g_hConOut, &source, &clip, dest, &fill);
      }
!     // Here we have to deal with a win32 console flake: If the scroll
!     // region looks like abc and we scroll c to a and fill with d we get
!     // cbd... if we scroll block c one line at a time to a, we get cdd...
!     // vim expects cdd consistently... So we have to deal with that
!     // here... (this also occurs scrolling the same way in the other
!     // direction).
  
      if (source.Bottom < dest.Y)
      {
  	COORD coord;
+ 	int   i;
  
! 	coord.X = source.Left;
! 	for (i = clip.Top; i < dest.Y; ++i)
! 	{
! 	    coord.Y = i;
! 	    clear_chars(coord, source.Right - source.Left + 1);
! 	}
      }
  }
  
***************
*** 6039,6088 ****
      static void
  delete_lines(unsigned cLines)
  {
!     SMALL_RECT	    source;
      COORD	    dest;
      CHAR_INFO	    fill;
      int		    nb;
  
!     dest.X = 0;
      dest.Y = g_coord.Y;
  
!     source.Left   = 0;
      source.Top	  = g_coord.Y + cLines;
      source.Right  = g_srScrollRegion.Right;
      source.Bottom = g_srScrollRegion.Bottom;
  
!     if (!USE_VTP)
      {
  	fill.Char.AsciiChar = ' ';
! 	fill.Attributes = g_attrCurrent;
  
- 	ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill);
-     }
-     else
-     {
  	set_console_color_rgb();
  
! 	gotoxy(1, source.Top + 1);
! 	vtp_printf("\033[%dS", cLines);
      }
! 
!     /* Here we have to deal with a win32 console flake: If the scroll
!      * region looks like abc and we scroll c to a and fill with d we get
!      * cbd... if we scroll block c one line at a time to a, we get cdd...
!      * vim expects cdd consistently... So we have to deal with that
!      * here... (this also occurs scrolling the same way in the other
!      * direction).  */
  
      nb = dest.Y + (source.Bottom - source.Top) + 1;
  
      if (nb < source.Top)
      {
  	COORD coord;
  
! 	coord.X = 0;
! 	coord.Y = nb;
! 	clear_chars(coord, Columns * (source.Top - nb));
      }
  }
  
--- 6065,6112 ----
      static void
  delete_lines(unsigned cLines)
  {
!     SMALL_RECT	    source, clip;
      COORD	    dest;
      CHAR_INFO	    fill;
      int		    nb;
  
!     dest.X = g_srScrollRegion.Left;
      dest.Y = g_coord.Y;
  
!     source.Left   = g_srScrollRegion.Left;
      source.Top	  = g_coord.Y + cLines;
      source.Right  = g_srScrollRegion.Right;
      source.Bottom = g_srScrollRegion.Bottom;
  
!     clip.Left   = g_srScrollRegion.Left;
!     clip.Top    = g_coord.Y;
!     clip.Right  = g_srScrollRegion.Right;
!     clip.Bottom = g_srScrollRegion.Bottom;
! 
      {
  	fill.Char.AsciiChar = ' ';
! 	fill.Attributes = g_attrDefault;
  
  	set_console_color_rgb();
  
! 	ScrollConsoleScreenBuffer(g_hConOut, &source, &clip, dest, &fill);
      }
!     // Here we have to deal with a win32 console flake; See insert_lines()
!     // above.
  
      nb = dest.Y + (source.Bottom - source.Top) + 1;
  
      if (nb < source.Top)
      {
  	COORD coord;
+ 	int   i;
  
! 	coord.X = source.Left;
! 	for (i = nb; i < clip.Bottom; ++i)
! 	{
! 	    coord.Y = i;
! 	    clear_chars(coord, source.Right - source.Left + 1);
! 	}
      }
  }
  
***************
*** 6508,6513 ****
--- 6532,6545 ----
  		{
  		    set_scroll_region(0, arg1 - 1, Columns - 1, arg2 - 1);
  		}
+ 		else if (argc == 2 && *p == 'R')
+ 		{
+ 		    set_scroll_region_tb(arg1, arg2);
+ 		}
+ 		else if (argc == 2 && *p == 'V')
+ 		{
+ 		    set_scroll_region_lr(arg1, arg2);
+ 		}
  		else if (argc == 1 && *p == 'A')
  		{
  		    gotoxy(g_coord.X + 1,
*** ../vim-8.1.0932/src/term.c	2019-02-12 20:46:45.247272511 +0100
--- src/term.c	2019-02-16 16:46:22.787339791 +0100
***************
*** 540,602 ****
   * are also translated in os_win32.c.
   */
      {(int)KS_NAME,	"win32"},
!     {(int)KS_CE,	"\033|K"},	/* clear to end of line */
!     {(int)KS_AL,	"\033|L"},	/* add new blank line */
  #  ifdef TERMINFO
!     {(int)KS_CAL,	"\033|%p1%dL"},	/* add number of new blank lines */
  #  else
!     {(int)KS_CAL,	"\033|%dL"},	/* add number of new blank lines */
  #  endif
!     {(int)KS_DL,	"\033|M"},	/* delete line */
  #  ifdef TERMINFO
!     {(int)KS_CDL,	"\033|%p1%dM"},	/* delete number of lines */
  #  else
!     {(int)KS_CDL,	"\033|%dM"},	/* delete number of lines */
  #  endif
!     {(int)KS_CL,	"\033|J"},	/* clear screen */
!     {(int)KS_CD,	"\033|j"},	/* clear to end of display */
!     {(int)KS_VI,	"\033|v"},	/* cursor invisible */
!     {(int)KS_VE,	"\033|V"},	/* cursor visible */
! 
!     {(int)KS_ME,	"\033|0m"},	/* normal */
!     {(int)KS_MR,	"\033|112m"},	/* reverse: black on lightgray */
!     {(int)KS_MD,	"\033|15m"},	/* bold: white on black */
  #if 1
!     {(int)KS_SO,	"\033|31m"},	/* standout: white on blue */
!     {(int)KS_SE,	"\033|0m"},	/* standout end */
  #else
!     {(int)KS_SO,	"\033|F"},	/* standout: high intensity */
!     {(int)KS_SE,	"\033|f"},	/* standout end */
  #endif
!     {(int)KS_CZH,	"\033|225m"},	/* italic: blue text on yellow */
!     {(int)KS_CZR,	"\033|0m"},	/* italic end */
!     {(int)KS_US,	"\033|67m"},	/* underscore: cyan text on red */
!     {(int)KS_UE,	"\033|0m"},	/* underscore end */
!     {(int)KS_CCO,	"16"},		/* allow 16 colors */
  #  ifdef TERMINFO
!     {(int)KS_CAB,	"\033|%p1%db"},	/* set background color */
!     {(int)KS_CAF,	"\033|%p1%df"},	/* set foreground color */
  #  else
!     {(int)KS_CAB,	"\033|%db"},	/* set background color */
!     {(int)KS_CAF,	"\033|%df"},	/* set foreground color */
  #  endif
  
!     {(int)KS_MS,	"y"},		/* save to move cur in reverse mode */
      {(int)KS_UT,	"y"},
      {(int)KS_XN,	"y"},
      {(int)KS_LE,	"\b"},
  #  ifdef TERMINFO
!     {(int)KS_CM,	"\033|%i%p1%d;%p2%dH"},/* cursor motion */
  #  else
!     {(int)KS_CM,	"\033|%i%d;%dH"},/* cursor motion */
  #  endif
!     {(int)KS_VB,	"\033|B"},	/* visual bell */
!     {(int)KS_TI,	"\033|S"},	/* put terminal in termcap mode */
!     {(int)KS_TE,	"\033|E"},	/* out of termcap mode */
  #  ifdef TERMINFO
!     {(int)KS_CS,	"\033|%i%p1%d;%p2%dr"},/* scroll region */
  #  else
!     {(int)KS_CS,	"\033|%i%d;%dr"},/* scroll region */
  #  endif
  #  ifdef FEAT_TERMGUICOLORS
      {(int)KS_8F,	"\033|38;2;%lu;%lu;%lum"},
--- 540,604 ----
   * are also translated in os_win32.c.
   */
      {(int)KS_NAME,	"win32"},
!     {(int)KS_CE,	"\033|K"},	// clear to end of line
!     {(int)KS_AL,	"\033|L"},	// add new blank line
  #  ifdef TERMINFO
!     {(int)KS_CAL,	"\033|%p1%dL"},	// add number of new blank lines
  #  else
!     {(int)KS_CAL,	"\033|%dL"},	// add number of new blank lines
  #  endif
!     {(int)KS_DL,	"\033|M"},	// delete line
  #  ifdef TERMINFO
!     {(int)KS_CDL,	"\033|%p1%dM"},	// delete number of lines
!     {(int)KS_CSV,	"\033|%p1%d;%p2%dV"},
  #  else
!     {(int)KS_CDL,	"\033|%dM"},	// delete number of lines
!     {(int)KS_CSV,	"\033|%d;%dV"},
  #  endif
!     {(int)KS_CL,	"\033|J"},	// clear screen
!     {(int)KS_CD,	"\033|j"},	// clear to end of display
!     {(int)KS_VI,	"\033|v"},	// cursor invisible
!     {(int)KS_VE,	"\033|V"},	// cursor visible
! 
!     {(int)KS_ME,	"\033|0m"},	// normal
!     {(int)KS_MR,	"\033|112m"},	// reverse: black on lightgray
!     {(int)KS_MD,	"\033|15m"},	// bold: white on black
  #if 1
!     {(int)KS_SO,	"\033|31m"},	// standout: white on blue
!     {(int)KS_SE,	"\033|0m"},	// standout end
  #else
!     {(int)KS_SO,	"\033|F"},	// standout: high intensity
!     {(int)KS_SE,	"\033|f"},	// standout end
  #endif
!     {(int)KS_CZH,	"\033|225m"},	// italic: blue text on yellow
!     {(int)KS_CZR,	"\033|0m"},	// italic end
!     {(int)KS_US,	"\033|67m"},	// underscore: cyan text on red
!     {(int)KS_UE,	"\033|0m"},	// underscore end
!     {(int)KS_CCO,	"16"},		// allow 16 colors
  #  ifdef TERMINFO
!     {(int)KS_CAB,	"\033|%p1%db"},	// set background color
!     {(int)KS_CAF,	"\033|%p1%df"},	// set foreground color
  #  else
!     {(int)KS_CAB,	"\033|%db"},	// set background color
!     {(int)KS_CAF,	"\033|%df"},	// set foreground color
  #  endif
  
!     {(int)KS_MS,	"y"},		// save to move cur in reverse mode
      {(int)KS_UT,	"y"},
      {(int)KS_XN,	"y"},
      {(int)KS_LE,	"\b"},
  #  ifdef TERMINFO
!     {(int)KS_CM,	"\033|%i%p1%d;%p2%dH"}, // cursor motion
  #  else
!     {(int)KS_CM,	"\033|%i%d;%dH"}, // cursor motion
  #  endif
!     {(int)KS_VB,	"\033|B"},	// visual bell
!     {(int)KS_TI,	"\033|S"},	// put terminal in termcap mode
!     {(int)KS_TE,	"\033|E"},	// out of termcap mode
  #  ifdef TERMINFO
!     {(int)KS_CS,	"\033|%i%p1%d;%p2%dr"}, // scroll region
  #  else
!     {(int)KS_CS,	"\033|%i%d;%dr"}, // scroll region
  #  endif
  #  ifdef FEAT_TERMGUICOLORS
      {(int)KS_8F,	"\033|38;2;%lu;%lu;%lum"},
***************
*** 6778,6786 ****
--- 6780,6792 ----
  #  ifdef TERMINFO
      {(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm"}, // set background color
      {(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm"}, // set foreground color
+     {(int)KS_CS,  "\033|%p1%d;%p2%dR", "\033|%p1%d;%p2%dR"},
+     {(int)KS_CSV, "\033|%p1%d;%p2%dV", "\033|%p1%d;%p2%dV"},
  #  else
      {(int)KS_CAB, "\033|%db", "\033|4%dm"}, // set background color
      {(int)KS_CAF, "\033|%df", "\033|3%dm"}, // set foreground color
+     {(int)KS_CS,  "\033|%d;%dR", "\033|%d;%dR"},
+     {(int)KS_CSV, "\033|%d;%dV", "\033|%d;%dV"},
  #  endif
      {(int)KS_CCO, "256", "256"},	    // colors
      {(int)KS_NAME}			    // terminator
*** ../vim-8.1.0932/src/version.c	2019-02-16 15:09:21.225946157 +0100
--- src/version.c	2019-02-16 16:46:41.599260036 +0100
***************
*** 781,782 ****
--- 781,784 ----
  {   /* Add new patch number below this line */
+ /**/
+     933,
  /**/

-- 
FIRST VILLAGER: We have found a witch.  May we burn her?
                 "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/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///