4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: ":sort n" sorts lines without a number as number zero. (Beeyawned)
12 Solution: Make lines without a number sort before lines with a number. Also
13 fix sorting negative numbers.
14 Files: src/ex_cmds.c, src/testdir/test57.in, src/testdir/test57.ok
17 *** ../vim-7.3.028/src/ex_cmds.c 2010-10-14 21:29:31.000000000 +0200
18 --- src/ex_cmds.c 2010-10-15 20:04:25.000000000 +0200
21 /* When sorting numbers "start_col_nr" is the number, not the column
24 ! result = l1.start_col_nr - l2.start_col_nr;
27 /* We need to copy one line into "sortbuf1", because there is no
29 /* When sorting numbers "start_col_nr" is the number, not the column
32 ! result = l1.start_col_nr == l2.start_col_nr ? 0
33 ! : l1.start_col_nr > l2.start_col_nr ? 1 : -1;
36 /* We need to copy one line into "sortbuf1", because there is no
39 * of the match, by temporarily terminating the string there */
43 /* Sorting on number: Store the number itself. */
47 * of the match, by temporarily terminating the string there */
51 /* Sorting on number: Store the number itself. */
57 if (s > p && s[-1] == '-')
58 --s; /* include preceding negative sign */
59 ! vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
60 ! &nrs[lnum - eap->line1].start_col_nr, NULL);
67 if (s > p && s[-1] == '-')
68 --s; /* include preceding negative sign */
70 ! /* empty line should sort before any number */
71 ! nrs[lnum - eap->line1].start_col_nr = -MAXLNUM;
73 ! vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
74 ! &nrs[lnum - eap->line1].start_col_nr, NULL);
83 sign_T *sn_next; /* next sign in list */
84 ! int sn_typenr; /* type number of sign (negative if not equal
86 char_u *sn_name; /* name of sign */
87 char_u *sn_icon; /* name of pixmap */
88 #ifdef FEAT_SIGN_ICONS
92 sign_T *sn_next; /* next sign in list */
93 ! int sn_typenr; /* type number of sign */
94 char_u *sn_name; /* name of sign */
95 char_u *sn_icon; /* name of pixmap */
96 #ifdef FEAT_SIGN_ICONS
97 *** ../vim-7.3.028/src/testdir/test57.in 2010-08-15 21:57:29.000000000 +0200
98 --- src/testdir/test57.in 2010-10-15 20:12:23.000000000 +0200
136 *** ../vim-7.3.028/src/testdir/test57.ok 2010-08-15 21:57:29.000000000 +0200
137 --- src/testdir/test57.ok 2010-10-15 20:11:42.000000000 +0200
151 *** ../vim-7.3.028/src/version.c 2010-10-14 21:29:31.000000000 +0200
152 --- src/version.c 2010-10-15 20:13:52.000000000 +0200
156 { /* Add new patch number below this line */
162 When danger reared its ugly head,
163 He bravely turned his tail and fled
164 Yes, Brave Sir Robin turned about
165 And gallantly he chickened out
166 Bravely taking to his feet
167 He beat a very brave retreat
168 Bravest of the brave Sir Robin
169 Petrified of being dead
170 Soiled his pants then brave Sir Robin
171 Turned away and fled.
172 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
174 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
175 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
176 \\\ download, build and distribute -- http://www.A-A-P.org ///
177 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///