summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0118
blob: afcdf937e860df62042afca3df7ff59357e29e57 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0118
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.0118
Problem:    Duplicate error message for put command.
Solution:   Check return value of u_save(). (Jason Franklin)
Files:	    src/ops.c, src/testdir/test_messages.vim src/testdir/test_put.vim


*** ../vim-8.1.0117/src/ops.c	2018-06-23 19:22:45.610486284 +0200
--- src/ops.c	2018-06-27 20:35:21.160021864 +0200
***************
*** 3551,3559 ****
  	    return;
      }
  
!     /* Autocommands may be executed when saving lines for undo, which may make
!      * y_array invalid.  Start undo now to avoid that. */
!     u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
  
      if (insert_string != NULL)
      {
--- 3551,3560 ----
  	    return;
      }
  
!     /* Autocommands may be executed when saving lines for undo.  This might
!      * make "y_array" invalid, so we start undo now to avoid that. */
!     if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL)
! 	goto end;
  
      if (insert_string != NULL)
      {
*** ../vim-8.1.0117/src/testdir/test_messages.vim	2018-05-19 14:43:26.779509715 +0200
--- src/testdir/test_messages.vim	2018-06-27 20:35:21.160021864 +0200
***************
*** 39,45 ****
    endtry
  endfunction
  
! " Patch 7.4.1696 defined the "clearmode()" command for clearing the mode
  " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked.  Message
  " output could then be disturbed when 'cmdheight' was greater than one.
  " This test ensures that the bugfix for this issue remains in place.
--- 39,45 ----
    endtry
  endfunction
  
! " Patch 7.4.1696 defined the "clearmode()" function for clearing the mode
  " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked.  Message
  " output could then be disturbed when 'cmdheight' was greater than one.
  " This test ensures that the bugfix for this issue remains in place.
*** ../vim-8.1.0117/src/testdir/test_put.vim	2018-05-23 21:53:48.352478970 +0200
--- src/testdir/test_put.vim	2018-06-27 20:48:28.788199160 +0200
***************
*** 1,3 ****
--- 1,4 ----
+ " Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc.
  
  func Test_put_block()
    if !has('multi_byte')
***************
*** 58,60 ****
--- 59,106 ----
    call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$'))
    bw!
  endfunc
+ 
+ func Test_put_fails_when_nomodifiable()
+   new
+   set nomodifiable
+ 
+   normal! yy
+   call assert_fails(':put', 'E21')
+   call assert_fails(':put!', 'E21')
+   call assert_fails(':normal! p', 'E21')
+   call assert_fails(':normal! gp', 'E21')
+   call assert_fails(':normal! P', 'E21')
+   call assert_fails(':normal! gP', 'E21')
+ 
+   if has('mouse')
+     set mouse=n
+     call assert_fails('execute "normal! \<MiddleMouse>"', 'E21')
+     set mouse&
+   endif
+ 
+   bwipeout!
+ endfunc
+ 
+ " A bug was discovered where the Normal mode put commands (e.g., "p") would
+ " output duplicate error messages when invoked in a non-modifiable buffer.
+ func Test_put_p_errmsg_nodup()
+   new
+   set nomodifiable
+ 
+   normal! yy
+ 
+   func Capture_p_error()
+     redir => s:p_err
+     normal! p
+     redir END
+   endfunc
+ 
+   silent! call Capture_p_error()
+ 
+   " Error message output within a function should be three lines (the function
+   " name, the line number, and the error message).
+   call assert_equal(3, count(s:p_err, "\n"))
+ 
+   delfunction Capture_p_error
+   bwipeout!
+ endfunc
*** ../vim-8.1.0117/src/version.c	2018-06-26 23:18:40.593167147 +0200
--- src/version.c	2018-06-27 20:36:32.259661095 +0200
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     118,
  /**/

-- 
Would you care for a drink?   I mean, if it were, like,
disabled and you had to look after it?

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