diff options
author | kuuote <znmxodq1@gmail.com> | 2024-08-20 19:53:17 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-08-20 19:53:17 +0200 |
commit | 0fd1cb1b1fc90b68cb37f71e65289eadac3588a6 (patch) | |
tree | e112258006c2dc39a632fd102ce7084cae262037 | |
parent | 3840d2feaf1454c934f71a97aae7a56a5ceccef9 (diff) |
patch 9.1.0683: mode() returns wrong value with <Cmd> mappingv9.1.0683
Problem: mode() returns wrong value with <Cmd> mapping
Solution: Change decision priority of VIsual_active and move
visual mode a bit further down (kuuote)
closes: #15533
Signed-off-by: kuuote <znmxodq1@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r-- | src/misc1.c | 22 | ||||
-rw-r--r-- | src/testdir/test_functions.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 11 deletions
diff --git a/src/misc1.c b/src/misc1.c index 8348488862..0898efb33f 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -678,17 +678,6 @@ get_mode(char_u *buf) buf[i++] = 't'; } #endif - else if (VIsual_active) - { - if (VIsual_select) - buf[i++] = VIsual_mode + 's' - 'v'; - else - { - buf[i++] = VIsual_mode; - if (restart_VIsual_select) - buf[i++] = 's'; - } - } else if (State == MODE_HITRETURN || State == MODE_ASKMORE || State == MODE_SETWSIZE || State == MODE_CONFIRM) @@ -731,6 +720,17 @@ get_mode(char_u *buf) if ((State & MODE_CMDLINE) && cmdline_overstrike()) buf[i++] = 'r'; } + else if (VIsual_active) + { + if (VIsual_select) + buf[i++] = VIsual_mode + 's' - 'v'; + else + { + buf[i++] = VIsual_mode; + if (restart_VIsual_select) + buf[i++] = 's'; + } + } else { buf[i++] = 'n'; diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 8e973f6c9e..1021d05090 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -923,6 +923,10 @@ func Test_mode() call feedkeys("gQ\<Insert>\<F2>vi\<CR>", 'xt') call assert_equal("c-cvr", g:current_modes) + " Commandline mode in Visual mode should return "c-c", never "v-v". + call feedkeys("v\<Cmd>call input('')\<CR>\<F2>\<CR>\<Esc>", 'xt') + call assert_equal("c-c", g:current_modes) + " Executing commands in Vim Ex mode should return "cv", never "cvr", " as Cmdline editing has already ended. call feedkeys("gQcall Save_mode()\<CR>vi\<CR>", 'xt') diff --git a/src/version.c b/src/version.c index c4472cf609..8d26a0dc04 100644 --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 683, +/**/ 682, /**/ 681, |