From eaf3f36168f85c8e0ab7083cd996b9fbe937045d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 28 Jul 2021 16:51:53 +0200 Subject: [PATCH] patch 8.2.3236: mode() does not indicate using CTRL-O in Select mode Problem: mode() does not indicate using CTRL-O in Select mode. Solution: Use "vs" and similar. (closes #8640) --- runtime/doc/eval.txt | 4 ++++ src/globals.h | 2 ++ src/misc1.c | 4 ++++ src/normal.c | 1 - src/testdir/test_functions.vim | 10 ++++++++++ src/version.c | 2 ++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d5f5e8de5..d99c398a7 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7978,6 +7978,10 @@ mode([expr]) Return a string that indicates the current mode. s Select by character S Select by line CTRL-S Select blockwise + vs Visual by character using |v_CTRL-O| from + Select mode + Vs Visual by line using |v_CTRL-O| from Select mode + CTRL-Vs Visual blockwise using |v_CTRL-O| from Select mode i Insert ic Insert mode completion |compl-generic| ix Insert mode |i_CTRL-X| completion diff --git a/src/globals.h b/src/globals.h index 529901437..ebf236b00 100644 --- a/src/globals.h +++ b/src/globals.h @@ -882,6 +882,8 @@ EXTERN int VIsual_active INIT(= FALSE); // whether Visual mode is active EXTERN int VIsual_select INIT(= FALSE); // whether Select mode is active +EXTERN int restart_VIsual_select INIT(= 0); + // restart Select mode when next cmd finished EXTERN int VIsual_reselect; // whether to restart the selection after a // Select mode mapping or menu diff --git a/src/misc1.c b/src/misc1.c index 7d7f022f1..9708502ca 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -652,7 +652,11 @@ f_mode(typval_T *argvars, typval_T *rettv) if (VIsual_select) buf[0] = VIsual_mode + 's' - 'v'; else + { buf[0] = VIsual_mode; + if (restart_VIsual_select) + buf[1] = 's'; + } } else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE || State == CONFIRM) diff --git a/src/normal.c b/src/normal.c index 74c76b2d2..0e1e11801 100644 --- a/src/normal.c +++ b/src/normal.c @@ -15,7 +15,6 @@ #include "vim.h" static int VIsual_mode_orig = NUL; // saved Visual mode -static int restart_VIsual_select = 0; #ifdef FEAT_EVAL static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount); diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 6f2797c49..de2db41f2 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -746,6 +746,7 @@ func Test_mode() set complete=. inoremap =Save_mode() + xnoremap call Save_mode() normal! 3G exe "normal i\\" @@ -857,6 +858,14 @@ func Test_mode() call assert_equal("\", mode(1)) call feedkeys("\", 'xt') + " v_CTRL-O + exe "normal gh\\\" + call assert_equal("v-vs", g:current_modes) + exe "normal gH\\\" + call assert_equal("V-Vs", g:current_modes) + exe "normal g\\\\" + call assert_equal("\-\s", g:current_modes) + call feedkeys(":echo \=Save_mode()\\", 'xt') call assert_equal('c-c', g:current_modes) call feedkeys("gQecho \=Save_mode()\\vi\", 'xt') @@ -867,6 +876,7 @@ func Test_mode() bwipe! iunmap + xunmap set complete& endfunc diff --git a/src/version.c b/src/version.c index ea232c37b..ed3d516e1 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3236, /**/ 3235, /**/ -- 2.40.0