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
|
To: vim_dev@googlegroups.com
Subject: Patch 7.3.534
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.534 (after 7.3.461)
Problem: When using an InsertCharPre autocommand autoindent fails.
Solution: Proper handling of v:char. (Alexey Radkov)
Files: src/edit.c
*** ../vim-7.3.533/src/edit.c 2012-05-18 16:35:17.000000000 +0200
--- src/edit.c 2012-06-01 14:41:06.000000000 +0200
***************
*** 10108,10129 ****
do_insert_char_pre(c)
int c;
{
! char_u *res;
/* Return quickly when there is nothing to do. */
if (!has_insertcharpre())
return NULL;
/* Lock the text to avoid weird things from happening. */
++textlock;
! set_vim_var_char(c); /* set v:char */
if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
! /* Get the new value of v:char. It may be empty or more than one
! * character. */
! res = vim_strsave(get_vim_var_str(VV_CHAR));
! else
! res = NULL;
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
--textlock;
--- 10108,10147 ----
do_insert_char_pre(c)
int c;
{
! char_u *res;
! #ifdef FEAT_MBYTE
! char_u buf[MB_MAXBYTES + 1];
! #else
! char_u buf[2];
! #endif
/* Return quickly when there is nothing to do. */
if (!has_insertcharpre())
return NULL;
+ #ifdef FEAT_MBYTE
+ if (has_mbyte)
+ buf[(*mb_char2bytes)(c, buf)] = NUL;
+ else
+ #endif
+ {
+ buf[0] = c;
+ buf[1] = NUL;
+ }
+
/* Lock the text to avoid weird things from happening. */
++textlock;
! set_vim_var_string(VV_CHAR, buf, -1); /* set v:char */
+ res = NULL;
if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
! {
! /* Get the value of v:char. It may be empty or more than one
! * character. Only use it when changed, otherwise continue with the
! * original character to avoid breaking autoindent. */
! if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0)
! res = vim_strsave(get_vim_var_str(VV_CHAR));
! }
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
--textlock;
*** ../vim-7.3.533/src/version.c 2012-06-01 13:46:06.000000000 +0200
--- src/version.c 2012-06-01 14:42:19.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
{ /* Add new patch number below this line */
+ /**/
+ 534,
/**/
--
hundred-and-one symptoms of being an internet addict:
11. You find yourself typing "com" after every period when using a word
processor.com
/// 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 ///
|