aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/edit.c3
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/testdir/test_popup.vim20
3 files changed, 24 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 9a8ff21263..73d8793a84 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3001,6 +3001,9 @@ static void ins_compl_addleader(int c)
{
int cc;
+ if (stop_arrow() == FAIL) {
+ return;
+ }
if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) {
char_u buf[MB_MAXBYTES + 1];
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index b0104a4e4c..02500a407c 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -174,7 +174,7 @@ void terminal_init(void)
VTerm *vt = vterm_new(24, 80);
VTermState *state = vterm_obtain_state(vt);
- for (int color_index = 0; color_index < 256; color_index++) {
+ for (int color_index = 255; color_index >= 0; color_index--) {
VTermColor color;
// Some of the default 16 colors has the same color as the later
// 240 colors. To avoid collisions, we will use the custom colors
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim
index 50110dd622..edc6336aa7 100644
--- a/src/nvim/testdir/test_popup.vim
+++ b/src/nvim/testdir/test_popup.vim
@@ -482,4 +482,24 @@ func Test_completion_ctrl_e_without_autowrap()
q!
endfunc
+func CompleteUndo() abort
+ call complete(1, g:months)
+ return ''
+endfunc
+
+func Test_completion_can_undo()
+ inoremap <Right> <c-r>=CompleteUndo()<cr>
+ set completeopt+=noinsert,noselect
+
+ new
+ call feedkeys("a\<Right>a\<Esc>", 'xt')
+ call assert_equal('a', getline(1))
+ undo
+ call assert_equal('', getline(1))
+
+ bwipe!
+ set completeopt&
+ iunmap <Right>
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab