]>
Commit | Line | Data |
---|---|---|
d7160e4c ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.3.029 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.029 | |
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 | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 323,329 **** | |
21 | /* When sorting numbers "start_col_nr" is the number, not the column | |
22 | * number. */ | |
23 | if (sort_nr) | |
24 | ! result = l1.start_col_nr - l2.start_col_nr; | |
25 | else | |
26 | { | |
27 | /* We need to copy one line into "sortbuf1", because there is no | |
28 | --- 323,330 ---- | |
29 | /* When sorting numbers "start_col_nr" is the number, not the column | |
30 | * number. */ | |
31 | if (sort_nr) | |
32 | ! result = l1.start_col_nr == l2.start_col_nr ? 0 | |
33 | ! : l1.start_col_nr > l2.start_col_nr ? 1 : -1; | |
34 | else | |
35 | { | |
36 | /* We need to copy one line into "sortbuf1", because there is no | |
37 | *************** | |
38 | *** 482,488 **** | |
39 | * of the match, by temporarily terminating the string there */ | |
40 | s2 = s + end_col; | |
41 | c = *s2; | |
42 | ! (*s2) = 0; | |
43 | /* Sorting on number: Store the number itself. */ | |
44 | p = s + start_col; | |
45 | if (sort_hex) | |
46 | --- 483,489 ---- | |
47 | * of the match, by temporarily terminating the string there */ | |
48 | s2 = s + end_col; | |
49 | c = *s2; | |
50 | ! *s2 = NUL; | |
51 | /* Sorting on number: Store the number itself. */ | |
52 | p = s + start_col; | |
53 | if (sort_hex) | |
54 | *************** | |
55 | *** 491,499 **** | |
56 | s = skiptodigit(p); | |
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); | |
61 | ! (*s2) = c; | |
62 | } | |
63 | else | |
64 | { | |
65 | --- 492,504 ---- | |
66 | s = skiptodigit(p); | |
67 | if (s > p && s[-1] == '-') | |
68 | --s; /* include preceding negative sign */ | |
69 | ! if (*s == NUL) | |
70 | ! /* empty line should sort before any number */ | |
71 | ! nrs[lnum - eap->line1].start_col_nr = -MAXLNUM; | |
72 | ! else | |
73 | ! vim_str2nr(s, NULL, NULL, sort_oct, sort_hex, | |
74 | ! &nrs[lnum - eap->line1].start_col_nr, NULL); | |
75 | ! *s2 = c; | |
76 | } | |
77 | else | |
78 | { | |
79 | *************** | |
80 | *** 6556,6563 **** | |
81 | struct sign | |
82 | { | |
83 | sign_T *sn_next; /* next sign in list */ | |
84 | ! int sn_typenr; /* type number of sign (negative if not equal | |
85 | ! to name) */ | |
86 | char_u *sn_name; /* name of sign */ | |
87 | char_u *sn_icon; /* name of pixmap */ | |
88 | #ifdef FEAT_SIGN_ICONS | |
89 | --- 6561,6567 ---- | |
90 | struct sign | |
91 | { | |
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 | |
99 | *************** | |
100 | *** 53,67 **** | |
101 | t02: numeric | |
102 | abc | |
103 | ab | |
104 | - a | |
105 | a321 | |
106 | a123 | |
107 | a122 | |
108 | b321 | |
109 | b123 | |
110 | c123d | |
111 | 123b | |
112 | c321d | |
113 | b322b | |
114 | b321 | |
115 | b321b | |
116 | --- 53,71 ---- | |
117 | t02: numeric | |
118 | abc | |
119 | ab | |
120 | a321 | |
121 | a123 | |
122 | a122 | |
123 | + a | |
124 | + x-22 | |
125 | b321 | |
126 | b123 | |
127 | + | |
128 | c123d | |
129 | + -24 | |
130 | 123b | |
131 | c321d | |
132 | + 0 | |
133 | b322b | |
134 | b321 | |
135 | b321b | |
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 | |
138 | *************** | |
139 | *** 21,26 **** | |
140 | --- 21,30 ---- | |
141 | a | |
142 | ||
143 | ||
144 | + | |
145 | + -24 | |
146 | + x-22 | |
147 | + 0 | |
148 | a122 | |
149 | a123 | |
150 | b123 | |
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 | |
153 | *************** | |
154 | *** 716,717 **** | |
155 | --- 716,719 ---- | |
156 | { /* Add new patch number below this line */ | |
157 | + /**/ | |
158 | + 29, | |
159 | /**/ | |
160 | ||
161 | -- | |
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 | |
173 | ||
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 /// |