aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/textobject.c2
-rw-r--r--test/old/testdir/test_normal.vim17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index 0cfbb50684..2d1fd8c699 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -213,7 +213,7 @@ bool findpar(bool *pincl, int dir, int count, int what, bool both)
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 *line = ml_get(curr);
// Put the cursor on the last character in the last line and make the
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 6a8c15bd48..96992c4d89 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -4169,4 +4169,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