diff options
author | LemonBoy <thatlemon@gmail.com> | 2022-05-24 11:49:31 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-24 11:49:31 +0100 |
commit | 53737b5eeeab1f95964f78b055d6094fab559533 (patch) | |
tree | f572bd9a8a4d6c088fd5f0a74e8d800bfb4dd4e1 | |
parent | 971f6825ee845828bd5c8869487928a3f32cd467 (diff) | |
download | vim-git-53737b5eeeab1f95964f78b055d6094fab559533.tar.gz |
patch 8.2.5012: cannot select one character inside ()v8.2.5012
Problem: Cannot select one character inside ().
Solution: Do not try to extend the area if it is empty. (closes #10472,
closes #6616)
-rw-r--r-- | src/testdir/test_textobjects.vim | 22 | ||||
-rw-r--r-- | src/textobject.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim index 34894d068..b605d76f2 100644 --- a/src/testdir/test_textobjects.vim +++ b/src/testdir/test_textobjects.vim @@ -41,6 +41,24 @@ func Test_inner_block_with_cpo_M_right_backslash() call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green']) endfunc +func Test_inner_block_single_char() + new + call setline(1, "(a)") + + set selection=inclusive + let @" = '' + call assert_nobeep('norm! 0faviby') + call assert_equal('a', @") + + set selection=exclusive + let @" = '' + call assert_nobeep('norm! 0faviby') + call assert_equal('a', @") + + set selection& + bwipe! +endfunc + func Test_quote_selection_selection_exclusive() new call setline(1, "a 'bcde' f") @@ -49,11 +67,11 @@ func Test_quote_selection_selection_exclusive() exe "norm! fdvhi'y" call assert_equal('bcde', @") - let @"='dummy' + let @" = 'dummy' exe "norm! $gevi'y" call assert_equal('bcde', @") - let @"='dummy' + let @" = 'dummy' exe "norm! 0fbhvi'y" call assert_equal('bcde', @") diff --git a/src/textobject.c b/src/textobject.c index edaa64c51..9a8a91626 100644 --- a/src/textobject.c +++ b/src/textobject.c @@ -1133,8 +1133,10 @@ current_block( /* * In Visual mode, when the resulting area is not bigger than what we * started with, extend it to the next block, and then exclude again. + * Don't try to expand the area if the area is empty. */ if (!LT_POS(start_pos, old_start) && !LT_POS(old_end, curwin->w_cursor) + && !EQUAL_POS(start_pos, curwin->w_cursor) && VIsual_active) { curwin->w_cursor = old_start; diff --git a/src/version.c b/src/version.c index 5ea047ac3..dea37d6cd 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5012, +/**/ 5011, /**/ 5010, |