diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-23 22:04:46 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-24 00:09:28 -0400 |
commit | ed2d651b504012d89f00ea89814cfcb15a0faf3f (patch) | |
tree | a77d9eb185abffd65894873b4c798d23b549ff58 /src/nvim/edit.c | |
parent | 162bc62f56f85fb6c88b48aab2e3fc264f1612bb (diff) | |
download | rneovim-ed2d651b504012d89f00ea89814cfcb15a0faf3f.tar.gz rneovim-ed2d651b504012d89f00ea89814cfcb15a0faf3f.tar.bz2 rneovim-ed2d651b504012d89f00ea89814cfcb15a0faf3f.zip |
vim-patch:8.0.1482: using feedkeys() does not work to test completion
Problem: Using feedkeys() does not work to test Insert mode completion.
(Lifepillar)
Solution: Do not check for typed keys when executing :normal or feedkeys().
Fix thesaurus completion not working when 'complete' is empty.
https://github.com/vim/vim/commit/02ae9b4a93deea4993d7abe20485f91f1cce5e36
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 4e9f3ca6ee..57c4a5395c 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -514,7 +514,7 @@ static int insert_check(VimState *state) // If typed something may trigger CursorHoldI again. if (s->c != K_EVENT // but not in CTRL-X mode, a script can't restore the state - && ctrl_x_mode == 0) { + && ctrl_x_mode == CTRL_X_NORMAL) { did_cursorhold = false; } @@ -523,7 +523,10 @@ static int insert_check(VimState *state) s->inserted_space = false; } - if (can_cindent && cindent_on() && ctrl_x_mode == 0 && !compl_started) { + if (can_cindent + && cindent_on() + && ctrl_x_mode == CTRL_X_NORMAL + && !compl_started) { insert_do_cindent(s); } @@ -1209,7 +1212,8 @@ check_pum: // if 'complete' is empty then plain ^P is no longer special, // but it is under other ^X modes if (*curbuf->b_p_cpt == NUL - && ctrl_x_mode != 0 + && (ctrl_x_mode == CTRL_X_NORMAL + || ctrl_x_mode == CTRL_X_WHOLE_LINE) && !(compl_cont_status & CONT_LOCAL)) { goto normalchar; } @@ -4535,12 +4539,12 @@ void ins_compl_check_keys(int frequency, int in_compl_func) { static int count = 0; - int c; - - /* Don't check when reading keys from a script. That would break the test - * scripts */ - if (using_script()) + // Don't check when reading keys from a script, :normal or feedkeys(). + // That would break the test scripts. But do check for keys when called + // from complete_check(). + if (!in_compl_func && (using_script() || ex_normal_busy)) { return; + } /* Only do this at regular intervals */ if (++count < frequency) @@ -4549,7 +4553,7 @@ void ins_compl_check_keys(int frequency, int in_compl_func) /* Check for a typed key. Do use mappings, otherwise vim_is_ctrl_x_key() * can't do its work correctly. */ - c = vpeekc_any(); + int c = vpeekc_any(); if (c != NUL) { if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R) { c = safe_vgetc(); /* Eat the character */ |