diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 3f97fa3baa..9de08bef81 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -251,6 +251,7 @@ CHANGED FEATURES *news-changed* These existing features changed their behavior. +• |gv| works in operator pending mode and does not abort. • 'smartcase' applies to completion filtering. • 'spellfile' location defaults to `stdpath("data").."/site/spell/"` instead of the first writable directory in 'runtimepath'. diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 45c1ea474d..ba30b5ddff 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5157,10 +5157,6 @@ static void nv_suspend(cmdarg_T *cap) /// exchange previous and current Visual area. static void nv_gv_cmd(cmdarg_T *cap) { - if (checkclearop(cap->oap)) { - return; - } - if (curbuf->b_visual.vi_start.lnum == 0 || curbuf->b_visual.vi_start.lnum > curbuf->b_ml.ml_line_count || curbuf->b_visual.vi_end.lnum == 0) { diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 465ed2bbed..89e9304226 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -2611,8 +2611,14 @@ func Test_normal33_g_cmd2() exe "norm! G0\4k4ly" exe "norm! gvood" call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'fgh', 'fgh', 'fgh', 'fgh', 'fgh'], getline(1,'$')) - " gv cannot be used in operator pending mode - call assert_beeps('normal! cgv') + " gv works in operator pending mode + call assert_nobeep('normal! cgvxyza') + call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'xyza', 'xyza', 'xyza', 'xyza', 'xyza'], getline(1,'$')) + exe "norm! ^\Gydgv..cgvbc" + call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'bc', 'bc', 'bc', 'bc', 'bc'], getline(1,'$')) + exe "norm! v^GragggUgv" + call assert_equal(['', 'abfgh', 'abfgh', 'abfgh', 'bA', 'AA', 'AA', 'AA', 'Ac'], getline(1,'$')) + " gv should beep without a previously selected visual area new call assert_beeps('normal! gv')