]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2188: cursor wrong after { in single line buffer v9.0.2188
authorGary Johnson <garyjohn@spocom.com>
Wed, 27 Dec 2023 18:12:43 +0000 (19:12 +0100)
committerChristian Brabandt <cb@256bit.org>
Wed, 27 Dec 2023 18:12:43 +0000 (19:12 +0100)
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 <garyjohn@spocom.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_normal.vim
src/textobject.c
src/version.c

index 6b889f46b3dd7cf64064afdffc8a9982cd3229fc..90bedf1800d08070503bce0eae3e406132b0b7bf 100644 (file)
@@ -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
index b315d0320c449076758f1dbdcc2c8bf3de4c6a4a..d03b6244ed8c685bec51e7613bcf953eba5c5ee9 100644 (file)
@@ -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);
 
index f7dc49bfe5f5995536f583e612074d556ed65b76..db1ab217ed3b686964155bbc3dae3af49c926d79 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2188,
 /**/
     2187,
 /**/