summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.429
blob: 801e25f9eb73464580aeaf92c1149a247f7d660d (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
To: vim_dev@googlegroups.com
Subject: Patch 7.3.429
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.429
Problem:    When 'cpoptions' includes "E" "c0" in the first column is an
            error. The redo register is then set to the errornous command.
Solution:   Do not set the redo register if the command fails because of an
            empty region. (Hideki Eiraku)
Files:      src/getchar.c, src/normal.c, src/proto/getchar.pro


*** ../vim-7.3.428/src/getchar.c	2012-01-10 22:26:12.000000000 +0100
--- src/getchar.c	2012-02-05 01:05:09.000000000 +0100
***************
*** 470,475 ****
--- 470,493 ----
      }
  }
  
+ /*
+  * Discard the contents of the redo buffer and restore the previous redo
+  * buffer.
+  */
+     void
+ CancelRedo()
+ {
+     if (!block_redo)
+     {
+ 	free_buff(&redobuff);
+ 	redobuff = old_redobuff;
+ 	old_redobuff.bh_first.b_next = NULL;
+ 	start_stuff();
+ 	while (read_stuff(TRUE) != NUL)
+ 	    ;
+     }
+ }
+ 
  #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
  /*
   * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
***************
*** 691,699 ****
   * Read a character from the redo buffer.  Translates K_SPECIAL, CSI and
   * multibyte characters.
   * The redo buffer is left as it is.
!  * if init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
!  * otherwise
!  * if old is TRUE, use old_redobuff instead of redobuff
   */
      static int
  read_redo(init, old_redo)
--- 709,717 ----
   * Read a character from the redo buffer.  Translates K_SPECIAL, CSI and
   * multibyte characters.
   * The redo buffer is left as it is.
!  * If init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
!  * otherwise.
!  * If old is TRUE, use old_redobuff instead of redobuff.
   */
      static int
  read_redo(init, old_redo)
*** ../vim-7.3.428/src/normal.c	2012-01-26 11:43:04.000000000 +0100
--- src/normal.c	2012-02-05 01:06:01.000000000 +0100
***************
*** 1978,1984 ****
--- 1978,1987 ----
  	    VIsual_reselect = FALSE;	    /* don't reselect now */
  #endif
  	    if (empty_region_error)
+ 	    {
  		vim_beep();
+ 		CancelRedo();
+ 	    }
  	    else
  	    {
  		(void)op_delete(oap);
***************
*** 1992,1998 ****
--- 1995,2004 ----
  	    if (empty_region_error)
  	    {
  		if (!gui_yank)
+ 		{
  		    vim_beep();
+ 		    CancelRedo();
+ 		}
  	    }
  	    else
  		(void)op_yank(oap, FALSE, !gui_yank);
***************
*** 2004,2010 ****
--- 2010,2019 ----
  	    VIsual_reselect = FALSE;	    /* don't reselect now */
  #endif
  	    if (empty_region_error)
+ 	    {
  		vim_beep();
+ 		CancelRedo();
+ 	    }
  	    else
  	    {
  		/* This is a new edit command, not a restart.  Need to
***************
*** 2066,2072 ****
--- 2075,2084 ----
  	case OP_LOWER:
  	case OP_ROT13:
  	    if (empty_region_error)
+ 	    {
  		vim_beep();
+ 		CancelRedo();
+ 	    }
  	    else
  		op_tilde(oap);
  	    check_cursor_col();
***************
*** 2099,2105 ****
--- 2111,2120 ----
  #endif
  #ifdef FEAT_VISUALEXTRA
  	    if (empty_region_error)
+ 	    {
  		vim_beep();
+ 		CancelRedo();
+ 	    }
  	    else
  	    {
  		/* This is a new edit command, not a restart.  Need to
***************
*** 2129,2135 ****
--- 2144,2153 ----
  #ifdef FEAT_VISUALEXTRA
  	    if (empty_region_error)
  #endif
+ 	    {
  		vim_beep();
+ 		CancelRedo();
+ 	    }
  #ifdef FEAT_VISUALEXTRA
  	    else
  		op_replace(oap, cap->nchar);
*** ../vim-7.3.428/src/proto/getchar.pro	2010-10-20 21:22:17.000000000 +0200
--- src/proto/getchar.pro	2012-02-05 01:05:20.000000000 +0100
***************
*** 4,11 ****
  char_u *get_inserted __ARGS((void));
  int stuff_empty __ARGS((void));
  void typeahead_noflush __ARGS((int c));
! void flush_buffers __ARGS((int typeahead));
  void ResetRedobuff __ARGS((void));
  void saveRedobuff __ARGS((void));
  void restoreRedobuff __ARGS((void));
  void AppendToRedobuff __ARGS((char_u *s));
--- 4,12 ----
  char_u *get_inserted __ARGS((void));
  int stuff_empty __ARGS((void));
  void typeahead_noflush __ARGS((int c));
! void flush_buffers __ARGS((int flush_typeahead));
  void ResetRedobuff __ARGS((void));
+ void CancelRedo __ARGS((void));
  void saveRedobuff __ARGS((void));
  void restoreRedobuff __ARGS((void));
  void AppendToRedobuff __ARGS((char_u *s));
*** ../vim-7.3.428/src/version.c	2012-02-05 00:47:56.000000000 +0100
--- src/version.c	2012-02-05 01:09:23.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     429,
  /**/

-- 
The History of every major Galactic Civilization tends to pass through
three distinct and recognizable phases, those of Survival, Inquiry and
Sophistication, otherwise known as the How, Why and Where phases.
For instance, the first phase is characterized by the question 'How can
we eat?' the second by the question 'Why do we eat?' and the third by
the question 'Where shall we have lunch?'
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

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