]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.534
- add patches 7.3.619-743
[packages/vim.git] / 7.3.534
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.534
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.534 (after 7.3.461)
11 Problem:    When using an InsertCharPre autocommand autoindent fails.
12 Solution:   Proper handling of v:char. (Alexey Radkov)
13 Files:      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 -- 
94 hundred-and-one symptoms of being an internet addict:
95 11. 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    ///
This page took 0.103418 seconds and 3 git commands to generate.