aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-09-02 16:44:08 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-09-02 18:40:56 -0400
commit02f126a2758e834a7e9dfbae0ede48bf8b90512f (patch)
treeaff61c2bc13ff9a811e7f2ad5d1fc422ce2d4bb7 /src/nvim/edit.c
parent07b209b1fec19d4e8d7e5390c664d582d6a3145c (diff)
downloadrneovim-02f126a2758e834a7e9dfbae0ede48bf8b90512f.tar.gz
rneovim-02f126a2758e834a7e9dfbae0ede48bf8b90512f.tar.bz2
rneovim-02f126a2758e834a7e9dfbae0ede48bf8b90512f.zip
vim-patch:8.0.1806: InsertCharPre causes problems for autocomplete
Problem: InsertCharPre causes problems for autocomplete. (Lifepillar) Solution: Check for InsertCharPre before calling vpeekc(). (Christian Brabandt, closes vim/vim#2876) https://github.com/vim/vim/commit/39de95257714b76ccd845d081cff57830a79b488
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index ca64cc091d..16c4882975 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -5541,13 +5541,15 @@ 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.
if (!ISSPECIAL(c)
&& (!has_mbyte || (*mb_char2len)(c) == 1)
+ && !has_event(EVENT_INSERTCHARPRE)
&& vpeekc() != NUL
&& !(State & REPLACE_FLAG)
&& !cindent_on()
- && !p_ri
- && !has_event(EVENT_INSERTCHARPRE)) {
+ && !p_ri) {
#define INPUT_BUFLEN 100
char_u buf[INPUT_BUFLEN + 1];
int i;