1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0416
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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 ///
|