mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.2188: cursor wrong after { in single line buffer (#26766)
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: vim/vim#13780
closes: vim/vim#13783
9e6549d2fb
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
This commit is contained in:
parent
d82e105727
commit
b3940cf8a1
@ -213,7 +213,7 @@ bool findpar(bool *pincl, int dir, int count, int what, bool both)
|
|||||||
curr++;
|
curr++;
|
||||||
}
|
}
|
||||||
curwin->w_cursor.lnum = 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);
|
char *line = ml_get(curr);
|
||||||
|
|
||||||
// Put the cursor on the last character in the last line and make the
|
// Put the cursor on the last character in the last line and make the
|
||||||
|
@ -4169,4 +4169,21 @@ func Test_normal34_zet_large()
|
|||||||
norm! z9765405999999999999
|
norm! z9765405999999999999
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user