Skip to content

Commit 9e6549d

Browse files
Gary Johnsonchrisbra
authored andcommitted
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 <garyjohn@spocom.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 2362772 commit 9e6549d

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/testdir/test_normal.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,4 +4164,21 @@ func Test_normal34_zet_large()
41644164
norm! z9765405999999999999
41654165
endfunc
41664166

4167+
" Test for { and } paragraph movements in a single line
4168+
func Test_brace_single_line()
4169+
let text =<< trim [DATA]
4170+
foobar one two three
4171+
[DATA]
4172+
4173+
new
4174+
call setline(1, text)
4175+
1
4176+
norm! 0}
4177+
4178+
call assert_equal([0, 1, 20, 0], getpos('.'))
4179+
norm! {
4180+
call assert_equal([0, 1, 1, 0], getpos('.'))
4181+
bw!
4182+
endfunc
4183+
41674184
" vim: shiftwidth=2 sts=2 expandtab

src/textobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ findpar(
226226
if (both && *ml_get(curr) == '}') // include line with '}'
227227
++curr;
228228
curwin->w_cursor.lnum = curr;
229-
if (curr == curbuf->b_ml.ml_line_count && what != '}')
229+
if (curr == curbuf->b_ml.ml_line_count && what != '}' && dir == FORWARD)
230230
{
231231
char_u *line = ml_get(curr);
232232

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
2188,
707709
/**/
708710
2187,
709711
/**/

0 commit comments

Comments
 (0)