diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2018-09-28 02:56:54 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-09-28 08:56:54 +0200 |
commit | b09f173d93b960df6706fcff0e9fd595eee467a4 (patch) | |
tree | 5ed04de7330a48450ff48ad26cdbd5c6f20aa0d7 /src | |
parent | 64a8a8fd228a58de4971621bdd405a2081356d11 (diff) | |
download | rneovim-b09f173d93b960df6706fcff0e9fd595eee467a4.tar.gz rneovim-b09f173d93b960df6706fcff0e9fd595eee467a4.tar.bz2 rneovim-b09f173d93b960df6706fcff0e9fd595eee467a4.zip |
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)
https://github.com/vim/vim/commit/b0e982bf05feb27eddb5f809b052c1137f4d4add
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_sort.vim | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 6f94dedd76..a091862e42 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -623,6 +623,7 @@ void ex_sort(exarg_T *eap) if (deleted > 0) { mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted, false); + msgmore(-deleted); } else if (deleted < 0) { mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, false); } diff --git a/src/nvim/testdir/test_sort.vim b/src/nvim/testdir/test_sort.vim index 6dc1d468c0..14d008a17f 100644 --- a/src/nvim/testdir/test_sort.vim +++ b/src/nvim/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 |