summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0511
blob: 52ee8ab7ad4c985fc21c5d8b786154263cc3de2d (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0511
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.0511
Problem:    ml_get error when calling a function with a range.
Solution:   Don't position the cursor after the last line.
Files:	    src/userfunc.c, src/testdir/test_functions.vim


*** ../vim-8.1.0510/src/userfunc.c	2018-10-25 13:31:33.833906872 +0200
--- src/userfunc.c	2018-11-04 23:38:59.813826045 +0100
***************
*** 3149,3154 ****
--- 3149,3161 ----
      {
  	if (!eap->skip && eap->addr_count > 0)
  	{
+ 	    if (lnum > curbuf->b_ml.ml_line_count)
+ 	    {
+ 		// If the function deleted lines or switched to another buffer
+ 		// the line number may become invalid.
+ 		EMSG(_(e_invrange));
+ 		break;
+ 	    }
  	    curwin->w_cursor.lnum = lnum;
  	    curwin->w_cursor.col = 0;
  #ifdef FEAT_VIRTUALEDIT
*** ../vim-8.1.0510/src/testdir/test_functions.vim	2018-10-07 18:43:02.524682045 +0200
--- src/testdir/test_functions.vim	2018-11-04 23:33:21.703374164 +0100
***************
*** 1119,1121 ****
--- 1119,1140 ----
    call assert_fails('call Fsandbox()', 'E48:')
    delfunc Fsandbox
  endfunc
+ 
+ func EditAnotherFile()
+   let word = expand('<cword>')
+   edit Xfuncrange2
+ endfunc
+ 
+ func Test_func_range_with_edit()
+   " Define a function that edits another buffer, then call it with a range that
+   " is invalid in that buffer.
+   call writefile(['just one line'], 'Xfuncrange2')
+   new
+   call setline(1, range(10))
+   write Xfuncrange1
+   call assert_fails('5,8call EditAnotherFile()', 'E16:')
+ 
+   call delete('Xfuncrange1')
+   call delete('Xfuncrange2')
+   bwipe!
+ endfunc
*** ../vim-8.1.0510/src/version.c	2018-11-04 14:40:42.347139567 +0100
--- src/version.c	2018-11-04 23:36:30.146573147 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     511,
  /**/

-- 
Proverb: A nightingale that forgets the lyrics is a hummingbird.

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