]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blame - vim/patches/vim-7.3.534.patch0
vim: Import latest patches from upstream.
[people/arne_f/ipfire-3.x.git] / vim / patches / vim-7.3.534.patch0
CommitLineData
c6060300
MT
1To: vim_dev@googlegroups.com
2Subject: Patch 7.3.534
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.3.534 (after 7.3.461)
11Problem: When using an InsertCharPre autocommand autoindent fails.
12Solution: Proper handling of v:char. (Alexey Radkov)
13Files: src/edit.c
14
15
16*** ../vim-7.3.533/src/edit.c 2012-05-18 16:35:17.000000000 +0200
17--- src/edit.c 2012-06-01 14:41:06.000000000 +0200
18***************
19*** 10108,10129 ****
20 do_insert_char_pre(c)
21 int c;
22 {
23! char_u *res;
24
25 /* Return quickly when there is nothing to do. */
26 if (!has_insertcharpre())
27 return NULL;
28
29 /* Lock the text to avoid weird things from happening. */
30 ++textlock;
31! set_vim_var_char(c); /* set v:char */
32
33 if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
34! /* Get the new value of v:char. It may be empty or more than one
35! * character. */
36! res = vim_strsave(get_vim_var_str(VV_CHAR));
37! else
38! res = NULL;
39
40 set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
41 --textlock;
42--- 10108,10147 ----
43 do_insert_char_pre(c)
44 int c;
45 {
46! char_u *res;
47! #ifdef FEAT_MBYTE
48! char_u buf[MB_MAXBYTES + 1];
49! #else
50! char_u buf[2];
51! #endif
52
53 /* Return quickly when there is nothing to do. */
54 if (!has_insertcharpre())
55 return NULL;
56
57+ #ifdef FEAT_MBYTE
58+ if (has_mbyte)
59+ buf[(*mb_char2bytes)(c, buf)] = NUL;
60+ else
61+ #endif
62+ {
63+ buf[0] = c;
64+ buf[1] = NUL;
65+ }
66+
67 /* Lock the text to avoid weird things from happening. */
68 ++textlock;
69! set_vim_var_string(VV_CHAR, buf, -1); /* set v:char */
70
71+ res = NULL;
72 if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
73! {
74! /* Get the value of v:char. It may be empty or more than one
75! * character. Only use it when changed, otherwise continue with the
76! * original character to avoid breaking autoindent. */
77! if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0)
78! res = vim_strsave(get_vim_var_str(VV_CHAR));
79! }
80
81 set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
82 --textlock;
83*** ../vim-7.3.533/src/version.c 2012-06-01 13:46:06.000000000 +0200
84--- src/version.c 2012-06-01 14:42:19.000000000 +0200
85***************
86*** 716,717 ****
87--- 716,719 ----
88 { /* Add new patch number below this line */
89+ /**/
90+ 534,
91 /**/
92
93--
94hundred-and-one symptoms of being an internet addict:
9511. You find yourself typing "com" after every period when using a word
96 processor.com
97
98 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
99/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
100\\\ an exciting new programming language -- http://www.Zimbu.org ///
101 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///