|
Karsten Hopp |
b63fed |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
b63fed |
Subject: Patch 7.3.534
|
|
Karsten Hopp |
b63fed |
Fcc: outbox
|
|
Karsten Hopp |
b63fed |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b63fed |
Mime-Version: 1.0
|
|
Karsten Hopp |
b63fed |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
b63fed |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b63fed |
------------
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
Patch 7.3.534 (after 7.3.461)
|
|
Karsten Hopp |
b63fed |
Problem: When using an InsertCharPre autocommand autoindent fails.
|
|
Karsten Hopp |
b63fed |
Solution: Proper handling of v:char. (Alexey Radkov)
|
|
Karsten Hopp |
b63fed |
Files: src/edit.c
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
*** ../vim-7.3.533/src/edit.c 2012-05-18 16:35:17.000000000 +0200
|
|
Karsten Hopp |
b63fed |
--- src/edit.c 2012-06-01 14:41:06.000000000 +0200
|
|
Karsten Hopp |
b63fed |
***************
|
|
Karsten Hopp |
b63fed |
*** 10108,10129 ****
|
|
Karsten Hopp |
b63fed |
do_insert_char_pre(c)
|
|
Karsten Hopp |
b63fed |
int c;
|
|
Karsten Hopp |
b63fed |
{
|
|
Karsten Hopp |
b63fed |
! char_u *res;
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
/* Return quickly when there is nothing to do. */
|
|
Karsten Hopp |
b63fed |
if (!has_insertcharpre())
|
|
Karsten Hopp |
b63fed |
return NULL;
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
/* Lock the text to avoid weird things from happening. */
|
|
Karsten Hopp |
b63fed |
++textlock;
|
|
Karsten Hopp |
b63fed |
! set_vim_var_char(c); /* set v:char */
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
|
|
Karsten Hopp |
b63fed |
! /* Get the new value of v:char. It may be empty or more than one
|
|
Karsten Hopp |
b63fed |
! * character. */
|
|
Karsten Hopp |
b63fed |
! res = vim_strsave(get_vim_var_str(VV_CHAR));
|
|
Karsten Hopp |
b63fed |
! else
|
|
Karsten Hopp |
b63fed |
! res = NULL;
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
|
|
Karsten Hopp |
b63fed |
--textlock;
|
|
Karsten Hopp |
b63fed |
--- 10108,10147 ----
|
|
Karsten Hopp |
b63fed |
do_insert_char_pre(c)
|
|
Karsten Hopp |
b63fed |
int c;
|
|
Karsten Hopp |
b63fed |
{
|
|
Karsten Hopp |
b63fed |
! char_u *res;
|
|
Karsten Hopp |
b63fed |
! #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
b63fed |
! char_u buf[MB_MAXBYTES + 1];
|
|
Karsten Hopp |
b63fed |
! #else
|
|
Karsten Hopp |
b63fed |
! char_u buf[2];
|
|
Karsten Hopp |
b63fed |
! #endif
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
/* Return quickly when there is nothing to do. */
|
|
Karsten Hopp |
b63fed |
if (!has_insertcharpre())
|
|
Karsten Hopp |
b63fed |
return NULL;
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
b63fed |
+ if (has_mbyte)
|
|
Karsten Hopp |
b63fed |
+ buf[(*mb_char2bytes)(c, buf)] = NUL;
|
|
Karsten Hopp |
b63fed |
+ else
|
|
Karsten Hopp |
b63fed |
+ #endif
|
|
Karsten Hopp |
b63fed |
+ {
|
|
Karsten Hopp |
b63fed |
+ buf[0] = c;
|
|
Karsten Hopp |
b63fed |
+ buf[1] = NUL;
|
|
Karsten Hopp |
b63fed |
+ }
|
|
Karsten Hopp |
b63fed |
+
|
|
Karsten Hopp |
b63fed |
/* Lock the text to avoid weird things from happening. */
|
|
Karsten Hopp |
b63fed |
++textlock;
|
|
Karsten Hopp |
b63fed |
! set_vim_var_string(VV_CHAR, buf, -1); /* set v:char */
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
+ res = NULL;
|
|
Karsten Hopp |
b63fed |
if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL, FALSE, curbuf))
|
|
Karsten Hopp |
b63fed |
! {
|
|
Karsten Hopp |
b63fed |
! /* Get the value of v:char. It may be empty or more than one
|
|
Karsten Hopp |
b63fed |
! * character. Only use it when changed, otherwise continue with the
|
|
Karsten Hopp |
b63fed |
! * original character to avoid breaking autoindent. */
|
|
Karsten Hopp |
b63fed |
! if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0)
|
|
Karsten Hopp |
b63fed |
! res = vim_strsave(get_vim_var_str(VV_CHAR));
|
|
Karsten Hopp |
b63fed |
! }
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
|
|
Karsten Hopp |
b63fed |
--textlock;
|
|
Karsten Hopp |
b63fed |
*** ../vim-7.3.533/src/version.c 2012-06-01 13:46:06.000000000 +0200
|
|
Karsten Hopp |
b63fed |
--- src/version.c 2012-06-01 14:42:19.000000000 +0200
|
|
Karsten Hopp |
b63fed |
***************
|
|
Karsten Hopp |
b63fed |
*** 716,717 ****
|
|
Karsten Hopp |
b63fed |
--- 716,719 ----
|
|
Karsten Hopp |
b63fed |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b63fed |
+ /**/
|
|
Karsten Hopp |
b63fed |
+ 534,
|
|
Karsten Hopp |
b63fed |
/**/
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
--
|
|
Karsten Hopp |
b63fed |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
b63fed |
11. You find yourself typing "com" after every period when using a word
|
|
Karsten Hopp |
b63fed |
processor.com
|
|
Karsten Hopp |
b63fed |
|
|
Karsten Hopp |
b63fed |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b63fed |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b63fed |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
b63fed |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|