summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0320
blob: dc31811140163e97be66f7be32abc4e2a6592f65 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0320
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.0320
Problem:    Too much 'incsearch' highlight for pattern matching everything.
Solution:   Add the skiplen to the command and remove the line range.
            (Christian Brabandt)  Check for empty pattern earlier.
Files:	    src/ex_getln.c, src/testdir/test_search.vim,
            src/testdir/dumps/Test_incsearch_substitute_09.dump


*** ../vim-8.1.0319/src/ex_getln.c	2018-08-18 21:23:00.787474060 +0200
--- src/ex_getln.c	2018-08-22 22:35:09.131882839 +0200
***************
*** 285,290 ****
--- 285,291 ----
      char_u	*dummy;
      exarg_T	ea;
      pos_T	save_cursor;
+     int		use_last_pat;
  
      *skiplen = 0;
      *patlen = ccline.cmdlen;
***************
*** 361,370 ****
      delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
      end = skip_regexp(p, delim, p_magic, NULL);
  
!     if (end == p && *end != delim)
  	return FALSE;
-     // found a non-empty pattern or //
  
      *skiplen = (int)(p - ccline.cmdbuff);
      *patlen = (int)(end - p);
  
--- 362,386 ----
      delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
      end = skip_regexp(p, delim, p_magic, NULL);
  
!     use_last_pat = end == p && *end == delim;
! 
!     if (end == p && !use_last_pat)
  	return FALSE;
  
+     // Don't do 'hlsearch' highlighting if the pattern matches everything.
+     if (!use_last_pat)
+     {
+ 	char c = *end;
+ 	int  empty;
+ 
+ 	*end = NUL;
+ 	empty = empty_pattern(p);
+ 	*end = c;
+ 	if (empty)
+ 	    return FALSE;
+     }
+ 
+     // found a non-empty pattern or //
      *skiplen = (int)(p - ccline.cmdbuff);
      *patlen = (int)(end - p);
  
***************
*** 556,572 ****
      else
  	end_pos = curwin->w_cursor; // shutup gcc 4
  
-     // Disable 'hlsearch' highlighting if the pattern matches everything.
-     // Avoids a flash when typing "foo\|".
-     if (!use_last_pat)
-     {
- 	next_char = ccline.cmdbuff[skiplen + patlen];
- 	ccline.cmdbuff[skiplen + patlen] = NUL;
- 	if (empty_pattern(ccline.cmdbuff))
- 	    set_no_hlsearch(TRUE);
- 	ccline.cmdbuff[skiplen + patlen] = next_char;
-     }
- 
      validate_cursor();
      // May redraw the status line to show the cursor position.
      if (p_ru && curwin->w_status_height > 0)
--- 572,577 ----
*** ../vim-8.1.0319/src/testdir/test_search.vim	2018-08-18 21:04:57.743864534 +0200
--- src/testdir/test_search.vim	2018-08-22 22:41:42.689971619 +0200
***************
*** 913,918 ****
--- 913,926 ----
    call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {})
    call term_sendkeys(buf, "\<Esc>")
  
+   " Only \v handled as empty pattern, does not move cursor
+   call term_sendkeys(buf, '3G4G')
+   call term_sendkeys(buf, ":nohlsearch\<CR>")
+   call term_sendkeys(buf, ':6,7s/\v')
+   sleep 100m
+   call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {})
+   call term_sendkeys(buf, "\<Esc>")
+ 
    call StopVimInTerminal(buf)
    call delete('Xis_subst_script')
  endfunc
*** ../vim-8.1.0319/src/testdir/dumps/Test_incsearch_substitute_09.dump	2018-08-22 23:02:14.943209354 +0200
--- src/testdir/dumps/Test_incsearch_substitute_09.dump	2018-08-22 22:41:52.269923211 +0200
***************
*** 0 ****
--- 1,9 ----
+ |f+0&#ffffff0|o@1| |3| @64
+ |f+8&&|o@1| |4| @64
+ |f+0&&|o@1| |5| @64
+ |f|o@1| |6| @64
+ |f|o@1| |7| @64
+ |f|o@1| |8| @64
+ |f|o@1| |9| @64
+ |f|o@1| |1|0| @63
+ |:|6|,|7|s|/|\|v> @61
*** ../vim-8.1.0319/src/version.c	2018-08-22 21:56:53.399893884 +0200
--- src/version.c	2018-08-22 23:02:25.679145625 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     320,
  /**/

-- 
   A village.  Sound of chanting of Latin canon, punctuated by short, sharp
   cracks.  It comes nearer.  We see it is a line of MONKS ala SEVENTH SEAL
   flagellation scene, chanting and banging themselves on the foreheads with
   wooden boards.
                 "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    ///