From: Bram Moolenaar Date: Tue, 10 Jan 2023 17:29:29 +0000 (+0000) Subject: patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short X-Git-Tag: v9.0.1172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79c11e399be3d96ed6d1c7458b1380e878ec717b;p=thirdparty%2Fvim.git patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short Problem: When 'selection' is "exclusive" then "1v" is one char short. Solution: Add one character when 'selection' is "exclusive. (closes #11791) --- diff --git a/src/normal.c b/src/normal.c index cc4e2467fc..c319be599a 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5472,7 +5472,9 @@ nv_visual(cmdarg_T *cap) if (resel_VIsual_line_count <= 1) { update_curswant_force(); - curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1; + curwin->w_curswant += resel_VIsual_vcol * cap->count0; + if (*p_sel != 'e') + --curwin->w_curswant; } else curwin->w_curswant = resel_VIsual_vcol; diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 573a2cf490..df781a0197 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1336,6 +1336,18 @@ func Test_visual_reselect_with_count() bwipe! endfunc +func Test_visual_reselect_exclusive() + new + call setline(1, ['abcde', 'abcde']) + set selection=exclusive + normal 1G0viwd + normal 2G01vd + call assert_equal(['', ''], getline(1, 2)) + + set selection& + bwipe! +endfunc + func Test_visual_block_insert_round_off() new " The number of characters are tuned to fill a 4096 byte allocated block, diff --git a/src/version.c b/src/version.c index da397ee4b4..6ab7b95dec 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1172, /**/ 1171, /**/