summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0425
blob: cde8ff82619fe2b4c8b20b2b88a3432571a2dc07 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0425
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.0425
Problem:    ml_get error and crash with appendbufline(). (Masashi Iizuka)
Solution:   Set per-window buffer info. (Hirohito Higashi, closes #3455)
Files:	    src/buffer.c, src/testdir/test_bufline.vim


*** ../vim-8.1.0424/src/buffer.c	2018-09-13 18:33:02.366426166 +0200
--- src/buffer.c	2018-09-21 16:58:58.049829001 +0200
***************
*** 428,434 ****
--- 428,437 ----
  
  	FOR_ALL_WINDOWS(wp)
  	    if (wp->w_buffer == buf)
+ 	    {
  		can_unload = FALSE;
+ 		break;
+ 	    }
      }
      if (!can_unload)
  	EMSG(_("E937: Attempt to delete a buffer that is in use"));
***************
*** 1742,1747 ****
--- 1745,1753 ----
      /* mark cursor position as being invalid */
      curwin->w_valid = 0;
  
+     buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
+ 					      curbuf->b_last_cursor.col, TRUE);
+ 
      /* Make sure the buffer is loaded. */
      if (curbuf->b_ml.ml_mfp == NULL)	/* need to load the file */
      {
*** ../vim-8.1.0424/src/testdir/test_bufline.vim	2018-06-07 18:17:42.278227523 +0200
--- src/testdir/test_bufline.vim	2018-09-21 16:49:25.778439112 +0200
***************
*** 91,96 ****
--- 91,123 ----
    exe "bwipe! " . b
  endfunc
  
+ func Test_appendbufline_no_E315()
+   let after = [
+     \ 'set stl=%f ls=2',
+     \ 'new',
+     \ 'let buf = bufnr("%")',
+     \ 'quit',
+     \ 'vsp',
+     \ 'exec "buffer" buf',
+     \ 'wincmd w',
+     \ 'call appendbufline(buf, 0, "abc")',
+     \ 'redraw',
+     \ 'while getbufline(buf, 1)[0] =~ "^\\s*$"',
+     \ '  sleep 10m',
+     \ 'endwhile',
+     \ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")',
+     \ 'au VimLeavePre * call writefile(["done"], "Xdone")',
+     \ 'qall!',
+     \ ]
+   if !RunVim([], after, '--clean')
+     return
+   endif
+   call assert_notmatch("^E315:", readfile("Xerror")[0])
+   call assert_equal("done", readfile("Xdone")[0])
+   call delete("Xerror")
+   call delete("Xdone")
+ endfunc
+ 
  func Test_deletebufline()
    new
    let b = bufnr('%')
*** ../vim-8.1.0424/src/version.c	2018-09-21 16:37:20.084248861 +0200
--- src/version.c	2018-09-21 16:58:24.382100516 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     425,
  /**/

-- 
I AM THANKFUL...
...for the mess to clean after a party because it means I have
been surrounded by friends.

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