To: vim_dev@googlegroups.com Subject: Patch 8.2.5012 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5012 Problem: Cannot select one character inside (). Solution: Do not try to extend the area if it is empty. (closes #10472, closes #6616) Files: src/textobject.c, src/testdir/test_textobjects.vim *** ../vim-8.2.5011/src/textobject.c 2022-05-09 13:15:03.710800121 +0100 --- src/textobject.c 2022-05-24 11:44:51.766416752 +0100 *************** *** 1133,1140 **** --- 1133,1142 ---- /* * 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; *** ../vim-8.2.5011/src/testdir/test_textobjects.vim 2022-05-09 13:15:03.710800121 +0100 --- src/testdir/test_textobjects.vim 2022-05-24 11:48:24.878229623 +0100 *************** *** 41,46 **** --- 41,64 ---- 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,59 **** exe "norm! fdvhi'y" call assert_equal('bcde', @") ! let @"='dummy' exe "norm! $gevi'y" call assert_equal('bcde', @") ! let @"='dummy' exe "norm! 0fbhvi'y" call assert_equal('bcde', @") --- 67,77 ---- exe "norm! fdvhi'y" call assert_equal('bcde', @") ! let @" = 'dummy' exe "norm! $gevi'y" call assert_equal('bcde', @") ! let @" = 'dummy' exe "norm! 0fbhvi'y" call assert_equal('bcde', @") *** ../vim-8.2.5011/src/version.c 2022-05-24 11:40:07.518685751 +0100 --- src/version.c 2022-05-24 11:46:58.670304197 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5012, /**/ -- Facepalm statement #6: "Estland is a fantasy place, just like Middle Earth and Madagaskar" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///