]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - vim/patches/vim-7.3.196.patch0
ppp: Re-add ifname patch
[people/ms/ipfire-3.x.git] / vim / patches / vim-7.3.196.patch0
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.196
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.196
11 Problem: Can't intercept a character that is going to be inserted.
12 Solution: Add the InsertCharPre autocommand event. (Jakson A. Aquino)
13 Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt,
14 runtime/doc/map.txt, src/edit.c, src/eval.c, src/fileio.c,
15 src/vim.h
16
17
18 *** ../mercurial/vim73/runtime/doc/autocmd.txt 2011-04-28 19:01:26.000000000 +0200
19 --- runtime/doc/autocmd.txt 2011-05-19 17:12:17.000000000 +0200
20 ***************
21 *** 299,304 ****
22 --- 299,306 ----
23 |InsertEnter| starting Insert mode
24 |InsertChange| when typing <Insert> while in Insert or Replace mode
25 |InsertLeave| when leaving Insert mode
26 + |InsertCharPre| when a character was typed in Insert mode, before
27 + inserting it
28
29 |ColorScheme| after loading a color scheme
30
31 ***************
32 *** 657,662 ****
33 --- 659,675 ----
34 indicates the new mode.
35 Be careful not to move the cursor or do
36 anything else that the user does not expect.
37 + *InsertCharPre*
38 + InsertCharPre When a character is typed in Insert mode,
39 + before inserting the char.
40 + The |v:char| variable indicates the char typed
41 + and can be changed during the event to insert
42 + a different character. When |v:char| is set
43 + to more than one character this text is
44 + inserted literally.
45 + It is not allowed to change the text |textlock|.
46 + The event is not triggered when 'paste' is
47 + set.
48 *InsertEnter*
49 InsertEnter Just before starting Insert mode. Also for
50 Replace mode and Virtual Replace mode. The
51 *** ../mercurial/vim73/runtime/doc/eval.txt 2011-05-19 12:22:41.000000000 +0200
52 --- runtime/doc/eval.txt 2011-05-19 16:55:58.000000000 +0200
53 ***************
54 *** 1293,1298 ****
55 --- 1293,1299 ----
56 *v:char* *char-variable*
57 v:char Argument for evaluating 'formatexpr' and used for the typed
58 character when using <expr> in an abbreviation |:map-<expr>|.
59 + It is also used by the |InsertPreChar| event.
60
61 *v:charconvert_from* *charconvert_from-variable*
62 v:charconvert_from
63 *** ../mercurial/vim73/runtime/doc/map.txt 2011-05-10 17:17:38.000000000 +0200
64 --- runtime/doc/map.txt 2011-05-19 16:40:34.000000000 +0200
65 ***************
66 *** 226,232 ****
67
68 For abbreviations |v:char| is set to the character that was typed to trigger
69 the abbreviation. You can use this to decide how to expand the {lhs}. You
70 ! can't change v:char and you should not insert it.
71
72 Be very careful about side effects! The expression is evaluated while
73 obtaining characters, you may very well make the command dysfunctional.
74 --- 226,232 ----
75
76 For abbreviations |v:char| is set to the character that was typed to trigger
77 the abbreviation. You can use this to decide how to expand the {lhs}. You
78 ! you should not either insert or change the v:char.
79
80 Be very careful about side effects! The expression is evaluated while
81 obtaining characters, you may very well make the command dysfunctional.
82 *** ../mercurial/vim73/src/edit.c 2011-05-10 14:22:10.000000000 +0200
83 --- src/edit.c 2011-05-19 17:20:53.000000000 +0200
84 ***************
85 *** 1381,1390 ****
86 goto do_intr;
87 #endif
88
89 /*
90 * Insert a nomal character.
91 */
92 ! normalchar:
93 #ifdef FEAT_SMARTINDENT
94 /* Try to perform smart-indenting. */
95 ins_try_si(c);
96 --- 1381,1425 ----
97 goto do_intr;
98 #endif
99
100 + normalchar:
101 /*
102 * Insert a nomal character.
103 */
104 ! #ifdef FEAT_AUTOCMD
105 ! if (!p_paste)
106 ! {
107 ! /* Trigger the InsertCharPre event. Lock the text to avoid
108 ! * weird things from happening. */
109 ! set_vim_var_char(c);
110 ! ++textlock;
111 ! if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL,
112 ! FALSE, curbuf))
113 ! {
114 ! /* Get the new value of v:char. If it is more than one
115 ! * character insert it literally. */
116 ! char_u *s = get_vim_var_str(VV_CHAR);
117 ! if (MB_CHARLEN(s) > 1)
118 ! {
119 ! if (stop_arrow() != FAIL)
120 ! {
121 ! ins_str(s);
122 ! AppendToRedobuffLit(s, -1);
123 ! }
124 ! c = NUL;
125 ! }
126 ! else
127 ! c = PTR2CHAR(s);
128 ! }
129 !
130 ! set_vim_var_string(VV_CHAR, NULL, -1);
131 ! --textlock;
132 !
133 ! /* If the new value is an empty string then don't insert a
134 ! * char. */
135 ! if (c == NUL)
136 ! break;
137 ! }
138 ! #endif
139 #ifdef FEAT_SMARTINDENT
140 /* Try to perform smart-indenting. */
141 ins_try_si(c);
142 ***************
143 *** 3491,3501 ****
144 return;
145 }
146 p += len;
147 ! #ifdef FEAT_MBYTE
148 ! c = mb_ptr2char(p);
149 ! #else
150 ! c = *p;
151 ! #endif
152 ins_compl_addleader(c);
153 }
154
155 --- 3526,3532 ----
156 return;
157 }
158 p += len;
159 ! c = PTR2CHAR(p);
160 ins_compl_addleader(c);
161 }
162
163 *** ../mercurial/vim73/src/eval.c 2011-05-19 14:59:07.000000000 +0200
164 --- src/eval.c 2011-05-19 16:40:39.000000000 +0200
165 ***************
166 *** 352,358 ****
167 {VV_NAME("swapname", VAR_STRING), VV_RO},
168 {VV_NAME("swapchoice", VAR_STRING), 0},
169 {VV_NAME("swapcommand", VAR_STRING), VV_RO},
170 ! {VV_NAME("char", VAR_STRING), VV_RO},
171 {VV_NAME("mouse_win", VAR_NUMBER), 0},
172 {VV_NAME("mouse_lnum", VAR_NUMBER), 0},
173 {VV_NAME("mouse_col", VAR_NUMBER), 0},
174 --- 352,358 ----
175 {VV_NAME("swapname", VAR_STRING), VV_RO},
176 {VV_NAME("swapchoice", VAR_STRING), 0},
177 {VV_NAME("swapcommand", VAR_STRING), VV_RO},
178 ! {VV_NAME("char", VAR_STRING), 0},
179 {VV_NAME("mouse_win", VAR_NUMBER), 0},
180 {VV_NAME("mouse_lnum", VAR_NUMBER), 0},
181 {VV_NAME("mouse_col", VAR_NUMBER), 0},
182 *** ../mercurial/vim73/src/fileio.c 2011-05-10 16:41:13.000000000 +0200
183 --- src/fileio.c 2011-05-19 16:40:39.000000000 +0200
184 ***************
185 *** 7662,7667 ****
186 --- 7662,7668 ----
187 {"InsertChange", EVENT_INSERTCHANGE},
188 {"InsertEnter", EVENT_INSERTENTER},
189 {"InsertLeave", EVENT_INSERTLEAVE},
190 + {"InsertCharPre", EVENT_INSERTCHARPRE},
191 {"MenuPopup", EVENT_MENUPOPUP},
192 {"QuickFixCmdPost", EVENT_QUICKFIXCMDPOST},
193 {"QuickFixCmdPre", EVENT_QUICKFIXCMDPRE},
194 *** ../mercurial/vim73/src/vim.h 2011-05-10 16:41:13.000000000 +0200
195 --- src/vim.h 2011-05-19 16:40:39.000000000 +0200
196 ***************
197 *** 1274,1279 ****
198 --- 1274,1280 ----
199 EVENT_WINENTER, /* after entering a window */
200 EVENT_WINLEAVE, /* before leaving a window */
201 EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */
202 + EVENT_INSERTCHARPRE, /* before inserting a char */
203 EVENT_CURSORHOLD, /* cursor in same position for a while */
204 EVENT_CURSORHOLDI, /* idem, in Insert mode */
205 EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */
206 *** ../vim-7.3.195/src/version.c 2011-05-19 16:35:05.000000000 +0200
207 --- src/version.c 2011-05-19 17:15:41.000000000 +0200
208 ***************
209 *** 711,712 ****
210 --- 711,714 ----
211 { /* Add new patch number below this line */
212 + /**/
213 + 196,
214 /**/
215
216 --
217 I AM THANKFUL...
218 ...for the mess to clean after a party because it means I have
219 been surrounded by friends.
220
221 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
222 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
223 \\\ an exciting new programming language -- http://www.Zimbu.org ///
224 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///