summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0499
blob: 4c7ee469280082dbd4ea53b0f557890ac442b9a5 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0499
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.0499
Problem:    :2vimgrep causes an ml_get error
Solution:   Pass tomatch pointer instead of value. (Yegappan Lakshmanan)
Files:	    src/ex_getln.c, src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0498/src/ex_getln.c	2018-09-30 21:43:17.187693348 +0200
--- src/ex_getln.c	2018-10-28 14:27:29.009350706 +0100
***************
*** 483,488 ****
--- 483,494 ----
      if (search_first_line == 0)
  	// start at the original cursor position
  	curwin->w_cursor = is_state->search_start;
+     else if (search_first_line > curbuf->b_ml.ml_line_count)
+     {
+ 	// start after the last line
+ 	curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+ 	curwin->w_cursor.col = MAXCOL;
+     }
      else
      {
  	// start at the first line in the range
*** ../vim-8.1.0498/src/quickfix.c	2018-10-21 18:47:39.622613657 +0200
--- src/quickfix.c	2018-10-28 14:22:29.387620432 +0100
***************
*** 5217,5223 ****
  	char_u	    *fname,
  	buf_T	    *buf,
  	regmmatch_T *regmatch,
! 	long	    tomatch,
  	int	    duplicate_name,
  	int	    flags)
  {
--- 5217,5223 ----
  	char_u	    *fname,
  	buf_T	    *buf,
  	regmmatch_T *regmatch,
! 	long	    *tomatch,
  	int	    duplicate_name,
  	int	    flags)
  {
***************
*** 5225,5231 ****
      long	lnum;
      colnr_T	col;
  
!     for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; ++lnum)
      {
  	col = 0;
  	while (vim_regexec_multi(regmatch, curwin, buf, lnum,
--- 5225,5231 ----
      long	lnum;
      colnr_T	col;
  
!     for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum)
      {
  	col = 0;
  	while (vim_regexec_multi(regmatch, curwin, buf, lnum,
***************
*** 5255,5261 ****
  		break;
  	    }
  	    found_match = TRUE;
! 	    if (--tomatch == 0)
  		break;
  	    if ((flags & VGR_GLOBAL) == 0
  		    || regmatch->endpos[0].lnum > 0)
--- 5255,5261 ----
  		break;
  	    }
  	    found_match = TRUE;
! 	    if (--*tomatch == 0)
  		break;
  	    if ((flags & VGR_GLOBAL) == 0
  		    || regmatch->endpos[0].lnum > 0)
***************
*** 5464,5470 ****
  	    // Try for a match in all lines of the buffer.
  	    // For ":1vimgrep" look for first match only.
  	    found_match = vgr_match_buflines(qi, fname, buf, &regmatch,
! 		    tomatch, duplicate_name, flags);
  
  	    if (using_dummy)
  	    {
--- 5464,5470 ----
  	    // Try for a match in all lines of the buffer.
  	    // For ":1vimgrep" look for first match only.
  	    found_match = vgr_match_buflines(qi, fname, buf, &regmatch,
! 		    &tomatch, duplicate_name, flags);
  
  	    if (using_dummy)
  	    {
*** ../vim-8.1.0498/src/testdir/test_quickfix.vim	2018-10-21 18:47:39.622613657 +0200
--- src/testdir/test_quickfix.vim	2018-10-28 14:20:59.812305616 +0100
***************
*** 2364,2369 ****
--- 2364,2384 ----
    call XvimgrepTests('l')
  endfunc
  
+ " Test for incsearch highlighting of the :vimgrep pattern
+ " This test used to cause "E315: ml_get: invalid lnum" errors.
+ func Test_vimgrep_incsearch()
+   enew
+   set incsearch
+   call test_override("char_avail", 1)
+ 
+   call feedkeys(":2vimgrep assert test_quickfix.vim test_cdo.vim\<CR>", "ntx")
+   let l = getqflist()
+   call assert_equal(2, len(l))
+ 
+   call test_override("ALL", 0)
+   set noincsearch
+ endfunc
+ 
  func XfreeTests(cchar)
    call s:setup_commands(a:cchar)
  
*** ../vim-8.1.0498/src/version.c	2018-10-27 14:27:17.539786667 +0200
--- src/version.c	2018-10-28 14:22:20.871685414 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     499,
  /**/

-- 
       Bravely bold Sir Robin, rode forth from Camelot,
       He was not afraid to die, Oh Brave Sir Robin,
       He was not at all afraid to be killed in nasty ways
       Brave, brave, brave, brave Sir Robin.
                 "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    ///