summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-08 22:48:00 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-08 22:48:00 +0200
commit39de95257714b76ccd845d081cff57830a79b488 (patch)
tree31dff74e8b3ea716ff75fc766932fe0542c58268 /src/edit.c
parent18cebf44177542e6658251bacf6152aa9009ca58 (diff)
patch 8.0.1806: InsertCharPre causes problems for autocompletev8.0.1806
Problem: InsertCharPre causes problems for autocomplete. (Lifepillar) Solution: Check for InsertCharPre before calling vpeekc(). (Christian Brabandt, closes #2876)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c
index eaf690ce9d..9b7206410e 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -6185,6 +6185,8 @@ insertchar(
* 'paste' is set)..
* Don't do this when there an InsertCharPre autocommand is defined,
* because we need to fire the event for every character.
+ * Do the check for InsertCharPre before the call to vpeekc() because the
+ * InsertCharPre autocommand could change the input buffer.
*/
#ifdef USE_ON_FLY_SCROLL
dont_scroll = FALSE; /* allow scrolling here */
@@ -6194,6 +6196,7 @@ insertchar(
#ifdef FEAT_MBYTE
&& (!has_mbyte || (*mb_char2len)(c) == 1)
#endif
+ && !has_insertcharpre()
&& vpeekc() != NUL
&& !(State & REPLACE_FLAG)
#ifdef FEAT_CINDENT
@@ -6202,7 +6205,7 @@ insertchar(
#ifdef FEAT_RIGHTLEFT
&& !p_ri
#endif
- && !has_insertcharpre())
+ )
{
#define INPUT_BUFLEN 100
char_u buf[INPUT_BUFLEN + 1];