mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0416: sort doesn't report deleted lines (#9062)
Problem: Sort doesn't report deleted lines.
Solution: Call msgmore(). (Christian Brabandt, closes vim/vim#3454)
b0e982bf05
This commit is contained in:
parent
64a8a8fd22
commit
b09f173d93
@ -623,6 +623,7 @@ void ex_sort(exarg_T *eap)
|
|||||||
if (deleted > 0) {
|
if (deleted > 0) {
|
||||||
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted,
|
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted,
|
||||||
false);
|
false);
|
||||||
|
msgmore(-deleted);
|
||||||
} else if (deleted < 0) {
|
} else if (deleted < 0) {
|
||||||
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, false);
|
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, false);
|
||||||
}
|
}
|
||||||
|
@ -1221,3 +1221,33 @@ func Test_sort_cmd()
|
|||||||
|
|
||||||
enew!
|
enew!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_sort_cmd_report()
|
||||||
|
enew!
|
||||||
|
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
|
||||||
|
$delete _
|
||||||
|
setlocal nomodified
|
||||||
|
let res = execute('%sort u')
|
||||||
|
|
||||||
|
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
|
||||||
|
call assert_match("6 fewer lines", res)
|
||||||
|
enew!
|
||||||
|
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
|
||||||
|
$delete _
|
||||||
|
setlocal nomodified report=10
|
||||||
|
let res = execute('%sort u')
|
||||||
|
|
||||||
|
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
|
||||||
|
call assert_equal("", res)
|
||||||
|
enew!
|
||||||
|
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
|
||||||
|
$delete _
|
||||||
|
setl report&vim
|
||||||
|
setlocal nomodified
|
||||||
|
let res = execute('1g/^/%sort u')
|
||||||
|
|
||||||
|
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
|
||||||
|
" the output comes from the :g command, not from the :sort
|
||||||
|
call assert_match("6 fewer lines", res)
|
||||||
|
enew!
|
||||||
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user