diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-11-17 21:48:59 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-11-17 21:51:19 -0500 |
commit | f484d3b2d4ec7f3a0c18c46125021aceedec03af (patch) | |
tree | 1049d562d64629c295ca985d67fea606100750ff | |
parent | e4b185893f511b050b8d38e92e3b1100e489dd9f (diff) | |
download | rneovim-f484d3b2d4ec7f3a0c18c46125021aceedec03af.tar.gz rneovim-f484d3b2d4ec7f3a0c18c46125021aceedec03af.tar.bz2 rneovim-f484d3b2d4ec7f3a0c18c46125021aceedec03af.zip |
vim-patch:8.1.2314: vi' sometimes does not select anything
Problem: vi' sometimes does not select anything.
Solution: Recognize an empty selection. (Christian Brabandt, closes vim/vim#5183)
https://github.com/vim/vim/commit/7170b295b06e3168424985530d8477ed2e058b67
-rw-r--r-- | src/nvim/search.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_textobjects.vim | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index d396e7551b..a298f7333e 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3808,8 +3808,9 @@ current_quote( } vis_bef_curs = lt(VIsual, curwin->w_cursor); + vis_empty = equalpos(VIsual, curwin->w_cursor); if (*p_sel == 'e') { - if (!vis_bef_curs) { + if (!vis_bef_curs && !vis_empty) { // VIsual needs to be start of Visual selection. pos_T t = curwin->w_cursor; @@ -3819,8 +3820,8 @@ current_quote( restore_vis_bef = true; } dec_cursor(); + vis_empty = equalpos(VIsual, curwin->w_cursor); } - vis_empty = equalpos(VIsual, curwin->w_cursor); } if (!vis_empty) { diff --git a/src/nvim/testdir/test_textobjects.vim b/src/nvim/testdir/test_textobjects.vim index 9194e0014d..448b2dc51c 100644 --- a/src/nvim/testdir/test_textobjects.vim +++ b/src/nvim/testdir/test_textobjects.vim @@ -48,6 +48,9 @@ func Test_quote_selection_selection_exclusive() set selection=exclusive exe "norm! fdvhi'y" call assert_equal('bcde', @") + let @"='dummy' + exe "norm! $gevi'y" + call assert_equal('bcde', @") set selection&vim bw! endfunc |