diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 894557818b..2c47421b02 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -196,6 +196,7 @@ gR Enter Virtual Replace mode: Each character you type *v_r* {Visual}r{char} Replace all selected characters by {char}. + CTRL-C will be inserted literally. *v_C* {Visual}["x]C Delete the highlighted lines [into register x] and diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 6ca486e8cf..0d1ea937c0 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -169,6 +169,7 @@ If you want to highlight exactly the same area as the last time, you can use CTRL-C In Visual mode: Stop Visual mode. When insert mode is pending (the mode message shows "-- (insert) VISUAL --"), it is also stopped. + On MS-Windows, you may need to press CTRL-Break. ============================================================================== 3. Changing the Visual area *visual-change* diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 4280d62a95..d730f247a9 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -4513,7 +4513,7 @@ static void nv_replace(cmdarg_T *cap) // Visual mode "r" if (VIsual_active) { if (got_int) { - reset_VIsual(); + got_int = false; } if (had_ctrl_v) { // Use a special (negative) number to make a difference between a diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index a12ecefc73..5d70492451 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -1577,4 +1577,18 @@ func Test_visual_hl_with_showbreak() call StopVimInTerminal(buf) endfunc +func Test_Visual_r_CTRL_C() + new + " visual r_cmd + call setline(1, [' ']) + call feedkeys("\$r\", 'tx') + call assert_equal([''], getline(1, 1)) + + " visual gr_cmd + call setline(1, [' ']) + call feedkeys("\$gr\", 'tx') + call assert_equal([''], getline(1, 1)) + bw! +endfu + " vim: shiftwidth=2 sts=2 expandtab