From 7ba11e06c0663ac12f110132d86cd463a7937a57 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 4 Oct 2021 03:04:51 +0800 Subject: vim-patch:8.2.3466: completion submode not indicated for virtual replace (#15886) Problem: Completion submode not indicated for virtual replace. Solution: Add submode to "Rv". (closes vim/vim#8945) https://github.com/vim/vim/commit/cc8cd4453332276d55b4a1109eace5785a4f319d --- src/nvim/state.c | 5 +++++ src/nvim/testdir/test_functions.vim | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'src') diff --git a/src/nvim/state.c b/src/nvim/state.c index a9f3d67849..04271d750c 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -161,6 +161,11 @@ char *get_mode(void) if (State & VREPLACE_FLAG) { buf[0] = 'R'; buf[1] = 'v'; + if (ins_compl_active()) { + buf[2] = 'c'; + } else if (ctrl_x_mode_not_defined_yet()) { + buf[2] = 'x'; + } } else { if (State & REPLACE_FLAG) { buf[0] = 'R'; diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index e82fefc7fc..366615821c 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -585,6 +585,8 @@ func Test_mode() exe "normal iabc\\\\u" call assert_equal('i-ic', g:current_modes) + exe "normal R\\" + call assert_equal('R-R', g:current_modes) " R_CTRL-P: Multiple matches exe "normal RBa\\\u" call assert_equal('R-Rc', g:current_modes) @@ -619,6 +621,42 @@ func Test_mode() exe "normal Rabc\\\\u" call assert_equal('R-Rc', g:current_modes) + exe "normal gR\\" + call assert_equal('R-Rv', g:current_modes) + " gR_CTRL-P: Multiple matches + exe "normal gRBa\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-P: Single match + exe "normal gRBro\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X + exe "normal gRBa\\\u" + call assert_equal('R-Rvx', g:current_modes) + " gR_CTRL-X CTRL-P: Multiple matches + exe "normal gRBa\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-P: Single match + exe "normal gRBro\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-P + CTRL-P: Single match + exe "normal gRBro\\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-L: Multiple matches + exe "normal gR\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-L: Single match + exe "normal gRBlu\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-P: No match + exe "normal gRCom\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-P: No match + exe "normal gRCom\\\\u" + call assert_equal('R-Rvc', g:current_modes) + " gR_CTRL-X CTRL-L: No match + exe "normal gRabc\\\\u" + call assert_equal('R-Rvc', g:current_modes) + call assert_equal('n', mode(0)) call assert_equal('n', mode(1)) -- cgit