patch 9.0.2188: cursor wrong after { in single line buffer Commit: https://github.com/vim/vim/commit/9e6549d2fb282c45a2492ea95fe7ba54c2082c3e Author: Gary Johnson <garyj...@spocom.com> Date: Wed Dec 27 19:12:43 2023 +0100
patch 9.0.2188: cursor wrong after { in single line buffer Problem: cursor wrong after { in single line buffer (Edwin Chan) Solution: do not place the cursor at the end for a single line buffer when moving backwards (Gary Johnson) closes: #13780 closes: #13783 Signed-off-by: Gary Johnson <garyj...@spocom.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 6b889f46b..90bedf180 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -4164,4 +4164,21 @@ func Test_normal34_zet_large() norm! z9765405999999999999 endfunc +" Test for { and } paragraph movements in a single line +func Test_brace_single_line() + let text =<< trim [DATA] + foobar one two three + [DATA] + + new + call setline(1, text) + 1 + norm! 0} + + call assert_equal([0, 1, 20, 0], getpos('.')) + norm! { + call assert_equal([0, 1, 1, 0], getpos('.')) + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/textobject.c b/src/textobject.c index b315d0320..d03b6244e 100644 --- a/src/textobject.c +++ b/src/textobject.c @@ -226,7 +226,7 @@ findpar( if (both && *ml_get(curr) == '}') // include line with '}' ++curr; curwin->w_cursor.lnum = curr; - if (curr == curbuf->b_ml.ml_line_count && what != '}') + if (curr == curbuf->b_ml.ml_line_count && what != '}' && dir == FORWARD) { char_u *line = ml_get(curr); diff --git a/src/version.c b/src/version.c index f7dc49bfe..db1ab217e 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 */ +/**/ + 2188, /**/ 2187, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1rIYfL-00Gqhr-F0%40256bit.org.