|
Karsten Hopp |
81a387 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
81a387 |
Subject: Patch 7.3.196
|
|
Karsten Hopp |
81a387 |
Fcc: outbox
|
|
Karsten Hopp |
81a387 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
81a387 |
Mime-Version: 1.0
|
|
Karsten Hopp |
81a387 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
81a387 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
81a387 |
------------
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
Patch 7.3.196
|
|
Karsten Hopp |
81a387 |
Problem: Can't intercept a character that is going to be inserted.
|
|
Karsten Hopp |
81a387 |
Solution: Add the InsertCharPre autocommand event. (Jakson A. Aquino)
|
|
Karsten Hopp |
81a387 |
Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt,
|
|
Karsten Hopp |
81a387 |
runtime/doc/map.txt, src/edit.c, src/eval.c, src/fileio.c,
|
|
Karsten Hopp |
81a387 |
src/vim.h
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/runtime/doc/autocmd.txt 2011-04-28 19:01:26.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- runtime/doc/autocmd.txt 2011-05-19 17:12:17.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 299,304 ****
|
|
Karsten Hopp |
81a387 |
--- 299,306 ----
|
|
Karsten Hopp |
81a387 |
|InsertEnter| starting Insert mode
|
|
Karsten Hopp |
81a387 |
|InsertChange| when typing <Insert> while in Insert or Replace mode
|
|
Karsten Hopp |
81a387 |
|InsertLeave| when leaving Insert mode
|
|
Karsten Hopp |
81a387 |
+ |InsertCharPre| when a character was typed in Insert mode, before
|
|
Karsten Hopp |
81a387 |
+ inserting it
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
|ColorScheme| after loading a color scheme
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 657,662 ****
|
|
Karsten Hopp |
81a387 |
--- 659,675 ----
|
|
Karsten Hopp |
81a387 |
indicates the new mode.
|
|
Karsten Hopp |
81a387 |
Be careful not to move the cursor or do
|
|
Karsten Hopp |
81a387 |
anything else that the user does not expect.
|
|
Karsten Hopp |
81a387 |
+ *InsertCharPre*
|
|
Karsten Hopp |
81a387 |
+ InsertCharPre When a character is typed in Insert mode,
|
|
Karsten Hopp |
81a387 |
+ before inserting the char.
|
|
Karsten Hopp |
81a387 |
+ The |v:char| variable indicates the char typed
|
|
Karsten Hopp |
81a387 |
+ and can be changed during the event to insert
|
|
Karsten Hopp |
81a387 |
+ a different character. When |v:char| is set
|
|
Karsten Hopp |
81a387 |
+ to more than one character this text is
|
|
Karsten Hopp |
81a387 |
+ inserted literally.
|
|
Karsten Hopp |
81a387 |
+ It is not allowed to change the text |textlock|.
|
|
Karsten Hopp |
81a387 |
+ The event is not triggered when 'paste' is
|
|
Karsten Hopp |
81a387 |
+ set.
|
|
Karsten Hopp |
81a387 |
*InsertEnter*
|
|
Karsten Hopp |
81a387 |
InsertEnter Just before starting Insert mode. Also for
|
|
Karsten Hopp |
81a387 |
Replace mode and Virtual Replace mode. The
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/runtime/doc/eval.txt 2011-05-19 12:22:41.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- runtime/doc/eval.txt 2011-05-19 16:55:58.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 1293,1298 ****
|
|
Karsten Hopp |
81a387 |
--- 1293,1299 ----
|
|
Karsten Hopp |
81a387 |
*v:char* *char-variable*
|
|
Karsten Hopp |
81a387 |
v:char Argument for evaluating 'formatexpr' and used for the typed
|
|
Karsten Hopp |
81a387 |
character when using <expr> in an abbreviation |:map-<expr>|.
|
|
Karsten Hopp |
81a387 |
+ It is also used by the |InsertPreChar| event.
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
*v:charconvert_from* *charconvert_from-variable*
|
|
Karsten Hopp |
81a387 |
v:charconvert_from
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/runtime/doc/map.txt 2011-05-10 17:17:38.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- runtime/doc/map.txt 2011-05-19 16:40:34.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 226,232 ****
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
For abbreviations |v:char| is set to the character that was typed to trigger
|
|
Karsten Hopp |
81a387 |
the abbreviation. You can use this to decide how to expand the {lhs}. You
|
|
Karsten Hopp |
81a387 |
! can't change v:char and you should not insert it.
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
Be very careful about side effects! The expression is evaluated while
|
|
Karsten Hopp |
81a387 |
obtaining characters, you may very well make the command dysfunctional.
|
|
Karsten Hopp |
81a387 |
--- 226,232 ----
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
For abbreviations |v:char| is set to the character that was typed to trigger
|
|
Karsten Hopp |
81a387 |
the abbreviation. You can use this to decide how to expand the {lhs}. You
|
|
Karsten Hopp |
81a387 |
! you should not either insert or change the v:char.
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
Be very careful about side effects! The expression is evaluated while
|
|
Karsten Hopp |
81a387 |
obtaining characters, you may very well make the command dysfunctional.
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/src/edit.c 2011-05-10 14:22:10.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- src/edit.c 2011-05-19 17:20:53.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 1381,1390 ****
|
|
Karsten Hopp |
81a387 |
goto do_intr;
|
|
Karsten Hopp |
81a387 |
#endif
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
/*
|
|
Karsten Hopp |
81a387 |
* Insert a nomal character.
|
|
Karsten Hopp |
81a387 |
*/
|
|
Karsten Hopp |
81a387 |
! normalchar:
|
|
Karsten Hopp |
81a387 |
#ifdef FEAT_SMARTINDENT
|
|
Karsten Hopp |
81a387 |
/* Try to perform smart-indenting. */
|
|
Karsten Hopp |
81a387 |
ins_try_si(c);
|
|
Karsten Hopp |
81a387 |
--- 1381,1425 ----
|
|
Karsten Hopp |
81a387 |
goto do_intr;
|
|
Karsten Hopp |
81a387 |
#endif
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
+ normalchar:
|
|
Karsten Hopp |
81a387 |
/*
|
|
Karsten Hopp |
81a387 |
* Insert a nomal character.
|
|
Karsten Hopp |
81a387 |
*/
|
|
Karsten Hopp |
81a387 |
! #ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
81a387 |
! if (!p_paste)
|
|
Karsten Hopp |
81a387 |
! {
|
|
Karsten Hopp |
81a387 |
! /* Trigger the InsertCharPre event. Lock the text to avoid
|
|
Karsten Hopp |
81a387 |
! * weird things from happening. */
|
|
Karsten Hopp |
81a387 |
! set_vim_var_char(c);
|
|
Karsten Hopp |
81a387 |
! ++textlock;
|
|
Karsten Hopp |
81a387 |
! if (apply_autocmds(EVENT_INSERTCHARPRE, NULL, NULL,
|
|
Karsten Hopp |
81a387 |
! FALSE, curbuf))
|
|
Karsten Hopp |
81a387 |
! {
|
|
Karsten Hopp |
81a387 |
! /* Get the new value of v:char. If it is more than one
|
|
Karsten Hopp |
81a387 |
! * character insert it literally. */
|
|
Karsten Hopp |
81a387 |
! char_u *s = get_vim_var_str(VV_CHAR);
|
|
Karsten Hopp |
81a387 |
! if (MB_CHARLEN(s) > 1)
|
|
Karsten Hopp |
81a387 |
! {
|
|
Karsten Hopp |
81a387 |
! if (stop_arrow() != FAIL)
|
|
Karsten Hopp |
81a387 |
! {
|
|
Karsten Hopp |
81a387 |
! ins_str(s);
|
|
Karsten Hopp |
81a387 |
! AppendToRedobuffLit(s, -1);
|
|
Karsten Hopp |
81a387 |
! }
|
|
Karsten Hopp |
81a387 |
! c = NUL;
|
|
Karsten Hopp |
81a387 |
! }
|
|
Karsten Hopp |
81a387 |
! else
|
|
Karsten Hopp |
81a387 |
! c = PTR2CHAR(s);
|
|
Karsten Hopp |
81a387 |
! }
|
|
Karsten Hopp |
81a387 |
!
|
|
Karsten Hopp |
81a387 |
! set_vim_var_string(VV_CHAR, NULL, -1);
|
|
Karsten Hopp |
81a387 |
! --textlock;
|
|
Karsten Hopp |
81a387 |
!
|
|
Karsten Hopp |
81a387 |
! /* If the new value is an empty string then don't insert a
|
|
Karsten Hopp |
81a387 |
! * char. */
|
|
Karsten Hopp |
81a387 |
! if (c == NUL)
|
|
Karsten Hopp |
81a387 |
! break;
|
|
Karsten Hopp |
81a387 |
! }
|
|
Karsten Hopp |
81a387 |
! #endif
|
|
Karsten Hopp |
81a387 |
#ifdef FEAT_SMARTINDENT
|
|
Karsten Hopp |
81a387 |
/* Try to perform smart-indenting. */
|
|
Karsten Hopp |
81a387 |
ins_try_si(c);
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 3491,3501 ****
|
|
Karsten Hopp |
81a387 |
return;
|
|
Karsten Hopp |
81a387 |
}
|
|
Karsten Hopp |
81a387 |
p += len;
|
|
Karsten Hopp |
81a387 |
! #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
81a387 |
! c = mb_ptr2char(p);
|
|
Karsten Hopp |
81a387 |
! #else
|
|
Karsten Hopp |
81a387 |
! c = *p;
|
|
Karsten Hopp |
81a387 |
! #endif
|
|
Karsten Hopp |
81a387 |
ins_compl_addleader(c);
|
|
Karsten Hopp |
81a387 |
}
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
--- 3526,3532 ----
|
|
Karsten Hopp |
81a387 |
return;
|
|
Karsten Hopp |
81a387 |
}
|
|
Karsten Hopp |
81a387 |
p += len;
|
|
Karsten Hopp |
81a387 |
! c = PTR2CHAR(p);
|
|
Karsten Hopp |
81a387 |
ins_compl_addleader(c);
|
|
Karsten Hopp |
81a387 |
}
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/src/eval.c 2011-05-19 14:59:07.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- src/eval.c 2011-05-19 16:40:39.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 352,358 ****
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapname", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapchoice", VAR_STRING), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
81a387 |
! {VV_NAME("char", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_win", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_lnum", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_col", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
--- 352,358 ----
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapname", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapchoice", VAR_STRING), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
81a387 |
! {VV_NAME("char", VAR_STRING), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_win", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_lnum", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
{VV_NAME("mouse_col", VAR_NUMBER), 0},
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/src/fileio.c 2011-05-10 16:41:13.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- src/fileio.c 2011-05-19 16:40:39.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 7662,7667 ****
|
|
Karsten Hopp |
81a387 |
--- 7662,7668 ----
|
|
Karsten Hopp |
81a387 |
{"InsertChange", EVENT_INSERTCHANGE},
|
|
Karsten Hopp |
81a387 |
{"InsertEnter", EVENT_INSERTENTER},
|
|
Karsten Hopp |
81a387 |
{"InsertLeave", EVENT_INSERTLEAVE},
|
|
Karsten Hopp |
81a387 |
+ {"InsertCharPre", EVENT_INSERTCHARPRE},
|
|
Karsten Hopp |
81a387 |
{"MenuPopup", EVENT_MENUPOPUP},
|
|
Karsten Hopp |
81a387 |
{"QuickFixCmdPost", EVENT_QUICKFIXCMDPOST},
|
|
Karsten Hopp |
81a387 |
{"QuickFixCmdPre", EVENT_QUICKFIXCMDPRE},
|
|
Karsten Hopp |
81a387 |
*** ../mercurial/vim73/src/vim.h 2011-05-10 16:41:13.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- src/vim.h 2011-05-19 16:40:39.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 1274,1279 ****
|
|
Karsten Hopp |
81a387 |
--- 1274,1280 ----
|
|
Karsten Hopp |
81a387 |
EVENT_WINENTER, /* after entering a window */
|
|
Karsten Hopp |
81a387 |
EVENT_WINLEAVE, /* before leaving a window */
|
|
Karsten Hopp |
81a387 |
EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */
|
|
Karsten Hopp |
81a387 |
+ EVENT_INSERTCHARPRE, /* before inserting a char */
|
|
Karsten Hopp |
81a387 |
EVENT_CURSORHOLD, /* cursor in same position for a while */
|
|
Karsten Hopp |
81a387 |
EVENT_CURSORHOLDI, /* idem, in Insert mode */
|
|
Karsten Hopp |
81a387 |
EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */
|
|
Karsten Hopp |
81a387 |
*** ../vim-7.3.195/src/version.c 2011-05-19 16:35:05.000000000 +0200
|
|
Karsten Hopp |
81a387 |
--- src/version.c 2011-05-19 17:15:41.000000000 +0200
|
|
Karsten Hopp |
81a387 |
***************
|
|
Karsten Hopp |
81a387 |
*** 711,712 ****
|
|
Karsten Hopp |
81a387 |
--- 711,714 ----
|
|
Karsten Hopp |
81a387 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
81a387 |
+ /**/
|
|
Karsten Hopp |
81a387 |
+ 196,
|
|
Karsten Hopp |
81a387 |
/**/
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
--
|
|
Karsten Hopp |
81a387 |
I AM THANKFUL...
|
|
Karsten Hopp |
81a387 |
...for the mess to clean after a party because it means I have
|
|
Karsten Hopp |
81a387 |
been surrounded by friends.
|
|
Karsten Hopp |
81a387 |
|
|
Karsten Hopp |
81a387 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
81a387 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
81a387 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
81a387 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|