To: vim_dev@googlegroups.com Subject: Patch 8.1.0416 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0416 Problem: Sort doesn't report deleted lines. Solution: Call msgmore(). (Christian Brabandt, closes #3454) Files: src/ex_cmds.c, src/testdir/test_sort.vim *** ../vim-8.1.0415/src/ex_cmds.c 2018-09-13 15:33:39.605712221 +0200 --- src/ex_cmds.c 2018-09-21 12:44:17.494880453 +0200 *************** *** 649,655 **** --- 649,658 ---- /* 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); *** ../vim-8.1.0415/src/testdir/test_sort.vim 2018-06-28 11:28:04.797455530 +0200 --- src/testdir/test_sort.vim 2018-09-21 12:43:02.327593721 +0200 *************** *** 1221,1223 **** --- 1221,1253 ---- 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 *** ../vim-8.1.0415/src/version.c 2018-09-21 12:24:08.618955563 +0200 --- src/version.c 2018-09-21 12:45:59.157931707 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 416, /**/ -- From "know your smileys": %-) After staring at screen for 15 hours /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///