changeset 14808:3d0b6e2a3a01 v8.1.0416

patch 8.1.0416: sort doesn't report deleted lines commit https://github.com/vim/vim/commit/b0e982bf05feb27eddb5f809b052c1137f4d4add Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 21 12:46:22 2018 +0200 patch 8.1.0416: sort doesn't report deleted lines Problem: Sort doesn't report deleted lines. Solution: Call msgmore(). (Christian Brabandt, closes https://github.com/vim/vim/issues/3454)
author Christian Brabandt <cb@256bit.org>
date Fri, 21 Sep 2018 13:00:06 +0200
parents e3a92ebfcba3
children d705b469b2ad
files src/ex_cmds.c src/testdir/test_sort.vim src/version.c
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -649,7 +649,10 @@ ex_sort(exarg_T *eap)
     /* Adjust marks for deleted (or added) lines and prepare for displaying. */
     deleted = (long)(count - (lnum - eap->line2));
     if (deleted > 0)
+    {
 	mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted);
+	msgmore(-deleted);
+    }
     else if (deleted < 0)
 	mark_adjust(eap->line2, MAXLNUM, -deleted, 0L);
 
--- a/src/testdir/test_sort.vim
+++ b/src/testdir/test_sort.vim
@@ -1221,3 +1221,33 @@ func Test_sort_cmd()
 
   enew!
 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
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    416,
+/**/
     415,
 /**/
     414,