1
0
forked from aniani/vim

patch 8.1.0416: sort doesn't report deleted lines

Problem:    Sort doesn't report deleted lines.
Solution:   Call msgmore(). (Christian Brabandt, closes #3454)
This commit is contained in:
Bram Moolenaar
2018-09-21 12:46:22 +02:00
parent d4f73438bb
commit b0e982bf05
3 changed files with 35 additions and 0 deletions

View File

@@ -649,7 +649,10 @@ ex_sort(exarg_T *eap)
/* Adjust marks for deleted (or added) lines and prepare for displaying. */ /* Adjust marks for deleted (or added) lines and prepare for displaying. */
deleted = (long)(count - (lnum - eap->line2)); deleted = (long)(count - (lnum - eap->line2));
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);
msgmore(-deleted);
}
else if (deleted < 0) else if (deleted < 0)
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L); mark_adjust(eap->line2, MAXLNUM, -deleted, 0L);

View File

@@ -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

View File

@@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
416,
/**/ /**/
415, 415,
/**/ /**/