mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.1252: ":marks" may show '< and '> mixed up
Problem: ":marks" may show '< and '> mixed up.
Solution: Show the mark position as where '< and '> would jump.
54c3fcd852
This commit is contained in:
parent
5f5bd576e5
commit
e5e547ded4
@ -632,6 +632,7 @@ void ex_marks(exarg_T *eap)
|
|||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
int i;
|
int i;
|
||||||
char_u *name;
|
char_u *name;
|
||||||
|
pos_T *posp, *startp, *endp;
|
||||||
|
|
||||||
if (arg != NULL && *arg == NUL)
|
if (arg != NULL && *arg == NUL)
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
@ -657,8 +658,18 @@ void ex_marks(exarg_T *eap)
|
|||||||
show_one_mark(']', arg, &curbuf->b_op_end, NULL, true);
|
show_one_mark(']', arg, &curbuf->b_op_end, NULL, true);
|
||||||
show_one_mark('^', arg, &curbuf->b_last_insert.mark, NULL, true);
|
show_one_mark('^', arg, &curbuf->b_last_insert.mark, NULL, true);
|
||||||
show_one_mark('.', arg, &curbuf->b_last_change.mark, NULL, true);
|
show_one_mark('.', arg, &curbuf->b_last_change.mark, NULL, true);
|
||||||
show_one_mark('<', arg, &curbuf->b_visual.vi_start, NULL, true);
|
|
||||||
show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, true);
|
// Show the marks as where they will jump to.
|
||||||
|
startp = &curbuf->b_visual.vi_start;
|
||||||
|
endp = &curbuf->b_visual.vi_end;
|
||||||
|
if ((lt(*startp, *endp) || endp->lnum == 0) && startp->lnum != 0) {
|
||||||
|
posp = startp;
|
||||||
|
} else {
|
||||||
|
posp = endp;
|
||||||
|
}
|
||||||
|
show_one_mark('<', arg, posp, NULL, true);
|
||||||
|
show_one_mark('>', arg, posp == startp ? endp : startp, NULL, true);
|
||||||
|
|
||||||
show_one_mark(-1, arg, NULL, NULL, false);
|
show_one_mark(-1, arg, NULL, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,33 +94,43 @@ func Test_marks_cmd()
|
|||||||
new Xtwo
|
new Xtwo
|
||||||
call setline(1, ['ccc', 'ddd'])
|
call setline(1, ['ccc', 'ddd'])
|
||||||
norm! $mcGmD
|
norm! $mcGmD
|
||||||
|
exe "norm! GVgg\<Esc>G"
|
||||||
w!
|
w!
|
||||||
|
|
||||||
b Xone
|
b Xone
|
||||||
let a = split(execute('marks'), "\n")
|
let a = split(execute('marks'), "\n")
|
||||||
call assert_equal(9, len(a))
|
call assert_equal(9, len(a))
|
||||||
call assert_equal('mark line col file/text', a[0])
|
call assert_equal(['mark line col file/text',
|
||||||
call assert_equal(" ' 2 0 bbb", a[1])
|
\ " ' 2 0 bbb",
|
||||||
call assert_equal(' a 1 0 aaa', a[2])
|
\ ' a 1 0 aaa',
|
||||||
call assert_equal(' B 2 2 bbb', a[3])
|
\ ' B 2 2 bbb',
|
||||||
call assert_equal(' D 2 0 Xtwo', a[4])
|
\ ' D 2 0 Xtwo',
|
||||||
call assert_equal(' " 1 0 aaa', a[5])
|
\ ' " 1 0 aaa',
|
||||||
call assert_equal(' [ 1 0 aaa', a[6])
|
\ ' [ 1 0 aaa',
|
||||||
call assert_equal(' ] 2 0 bbb', a[7])
|
\ ' ] 2 0 bbb',
|
||||||
call assert_equal(' . 2 0 bbb', a[8])
|
\ ' . 2 0 bbb'], a)
|
||||||
|
|
||||||
b Xtwo
|
b Xtwo
|
||||||
let a = split(execute('marks'), "\n")
|
let a = split(execute('marks'), "\n")
|
||||||
call assert_equal(9, len(a))
|
call assert_equal(11, len(a))
|
||||||
call assert_equal('mark line col file/text', a[0])
|
call assert_equal(['mark line col file/text',
|
||||||
call assert_equal(" ' 1 0 ccc", a[1])
|
\ " ' 1 0 ccc",
|
||||||
call assert_equal(' c 1 2 ccc', a[2])
|
\ ' c 1 2 ccc',
|
||||||
call assert_equal(' B 2 2 Xone', a[3])
|
\ ' B 2 2 Xone',
|
||||||
call assert_equal(' D 2 0 ddd', a[4])
|
\ ' D 2 0 ddd',
|
||||||
call assert_equal(' " 2 0 ddd', a[5])
|
\ ' " 2 0 ddd',
|
||||||
call assert_equal(' [ 1 0 ccc', a[6])
|
\ ' [ 1 0 ccc',
|
||||||
call assert_equal(' ] 2 0 ddd', a[7])
|
\ ' ] 2 0 ddd',
|
||||||
call assert_equal(' . 2 0 ddd', a[8])
|
\ ' . 2 0 ddd',
|
||||||
|
\ ' < 1 0 ccc',
|
||||||
|
\ ' > 2 0 ddd'], a)
|
||||||
|
norm! Gdd
|
||||||
|
w!
|
||||||
|
let a = split(execute('marks <>'), "\n")
|
||||||
|
call assert_equal(3, len(a))
|
||||||
|
call assert_equal(['mark line col file/text',
|
||||||
|
\ ' < 1 0 ccc',
|
||||||
|
\ ' > 2 0 -invalid-'], a)
|
||||||
|
|
||||||
b Xone
|
b Xone
|
||||||
delmarks aB
|
delmarks aB
|
||||||
|
Loading…
Reference in New Issue
Block a user