From: Jim Zhou Date: Mon, 3 Mar 2025 18:53:26 +0000 (+0100) Subject: patch 9.1.1167: mark '] wrong after copying text object X-Git-Tag: v9.1.1167^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=360a39ae6c823dd3e3c89c209b544f345c6d86dd;p=thirdparty%2Fvim.git patch 9.1.1167: mark '] wrong after copying text object Problem: mark '] wrong after copying text object (ubaldot) Solution: Adjust position of '] for non-linewise, exclusive motions (Jim Zhou) related: #16679 closes: #16772 Signed-off-by: Jim Zhou Signed-off-by: Christian Brabandt --- diff --git a/src/register.c b/src/register.c index 465bee3bed..7ba69be068 100644 --- a/src/register.c +++ b/src/register.c @@ -1374,6 +1374,9 @@ op_yank(oparg_T *oap, int deleting, int mess) curbuf->b_op_start.col = 0; curbuf->b_op_end.col = MAXCOL; } + if (yanktype != MLINE && !oap->inclusive) + // Exclude the end position. + decl(&curbuf->b_op_end); } #ifdef FEAT_CLIPBOARD diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim index 43f80be299..0ff1df84cf 100644 --- a/src/testdir/test_registers.vim +++ b/src/testdir/test_registers.vim @@ -1154,4 +1154,54 @@ func Test_register_cursor_column_negative() call StopVimInTerminal(buf) endfunc +" test '] mark generated by op_yank +func Test_mark_from_yank() + new + " double quote object + call setline(1, 'test "yank" mark') + normal! yi" + call assert_equal([0, 1, 10, 0], getpos("']")) + normal! ya" + call assert_equal(getpos("']"), [0, 1, 13, 0], getpos("']")) + " single quote object + call setline(1, 'test ''yank'' mark') + normal! yi' + call assert_equal([0, 1, 10, 0], getpos("']")) + normal! ya' + call assert_equal([0, 1, 13, 0], getpos("']")) + " paren object + call setline(1, 'test (yank) mark') + call cursor(1, 9) + normal! yi( + call assert_equal([0, 1, 10, 0], getpos("']")) + call cursor(1, 9) + normal! ya( + call assert_equal([0, 1, 11, 0], getpos("']")) + " brace object + call setline(1, 'test {yank} mark') + call cursor(1, 9) + normal! yi{ + call assert_equal([0, 1, 10, 0], getpos("']")) + call cursor(1, 9) + normal! ya{ + call assert_equal([0, 1, 11, 0], getpos("']")) + " bracket object + call setline(1, 'test [yank] mark') + call cursor(1, 9) + normal! yi[ + call assert_equal([0, 1, 10, 0], getpos("']")) + call cursor(1, 9) + normal! ya[ + call assert_equal([0, 1, 11, 0], getpos("']")) + " block object + call setline(1, 'test mark') + call cursor(1, 9) + normal! yi< + call assert_equal([0, 1, 10, 0], getpos("']")) + call cursor(1, 9) + normal! ya< + call assert_equal([0, 1, 11, 0], getpos("']")) + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 34459ef01e..29ea4beef6 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1167, /**/ 1166, /**/