summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.029
blob: 702c7cce43efd0f754514250d10362189675acae (plain) (blame)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
To: vim-dev@vim.org
Subject: Patch 7.3.029
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.029
Problem:    ":sort n" sorts lines without a number as number zero. (Beeyawned)
Solution:   Make lines without a number sort before lines with a number.  Also
	    fix sorting negative numbers.
Files:	    src/ex_cmds.c, src/testdir/test57.in, src/testdir/test57.ok


*** ../vim-7.3.028/src/ex_cmds.c	2010-10-14 21:29:31.000000000 +0200
--- src/ex_cmds.c	2010-10-15 20:04:25.000000000 +0200
***************
*** 323,329 ****
      /* When sorting numbers "start_col_nr" is the number, not the column
       * number. */
      if (sort_nr)
! 	result = l1.start_col_nr - l2.start_col_nr;
      else
      {
  	/* We need to copy one line into "sortbuf1", because there is no
--- 323,330 ----
      /* When sorting numbers "start_col_nr" is the number, not the column
       * number. */
      if (sort_nr)
! 	result = l1.start_col_nr == l2.start_col_nr ? 0
! 				 : l1.start_col_nr > l2.start_col_nr ? 1 : -1;
      else
      {
  	/* We need to copy one line into "sortbuf1", because there is no
***************
*** 482,488 ****
  	     * of the match, by temporarily terminating the string there */
  	    s2 = s + end_col;
  	    c = *s2;
! 	    (*s2) = 0;
  	    /* Sorting on number: Store the number itself. */
  	    p = s + start_col;
  	    if (sort_hex)
--- 483,489 ----
  	     * of the match, by temporarily terminating the string there */
  	    s2 = s + end_col;
  	    c = *s2;
! 	    *s2 = NUL;
  	    /* Sorting on number: Store the number itself. */
  	    p = s + start_col;
  	    if (sort_hex)
***************
*** 491,499 ****
  		s = skiptodigit(p);
  	    if (s > p && s[-1] == '-')
  		--s;  /* include preceding negative sign */
! 	    vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
! 					&nrs[lnum - eap->line1].start_col_nr, NULL);
! 	    (*s2) = c;
  	}
  	else
  	{
--- 492,504 ----
  		s = skiptodigit(p);
  	    if (s > p && s[-1] == '-')
  		--s;  /* include preceding negative sign */
! 	    if (*s == NUL)
! 		/* empty line should sort before any number */
! 		nrs[lnum - eap->line1].start_col_nr = -MAXLNUM;
! 	    else
! 		vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
! 				  &nrs[lnum - eap->line1].start_col_nr, NULL);
! 	    *s2 = c;
  	}
  	else
  	{
***************
*** 6556,6563 ****
  struct sign
  {
      sign_T	*sn_next;	/* next sign in list */
!     int		sn_typenr;	/* type number of sign (negative if not equal
! 				   to name) */
      char_u	*sn_name;	/* name of sign */
      char_u	*sn_icon;	/* name of pixmap */
  #ifdef FEAT_SIGN_ICONS
--- 6561,6567 ----
  struct sign
  {
      sign_T	*sn_next;	/* next sign in list */
!     int		sn_typenr;	/* type number of sign */
      char_u	*sn_name;	/* name of sign */
      char_u	*sn_icon;	/* name of pixmap */
  #ifdef FEAT_SIGN_ICONS
*** ../vim-7.3.028/src/testdir/test57.in	2010-08-15 21:57:29.000000000 +0200
--- src/testdir/test57.in	2010-10-15 20:12:23.000000000 +0200
***************
*** 53,67 ****
  t02: numeric
  abc
  ab
- a
  a321
  a123
  a122
  b321
  b123
  c123d
   123b
  c321d
  b322b
  b321
  b321b
--- 53,71 ----
  t02: numeric
  abc
  ab
  a321
  a123
  a122
+ a
+ x-22
  b321
  b123
+ 
  c123d
+ -24
   123b
  c321d
+ 0
  b322b
  b321
  b321b
*** ../vim-7.3.028/src/testdir/test57.ok	2010-08-15 21:57:29.000000000 +0200
--- src/testdir/test57.ok	2010-10-15 20:11:42.000000000 +0200
***************
*** 21,26 ****
--- 21,30 ----
  a
  
  
+ 
+ -24
+ x-22
+ 0
  a122
  a123
  b123
*** ../vim-7.3.028/src/version.c	2010-10-14 21:29:31.000000000 +0200
--- src/version.c	2010-10-15 20:13:52.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     29,
  /**/

-- 
       When danger reared its ugly head,
       He bravely turned his tail and fled
       Yes, Brave Sir Robin turned about
       And gallantly he chickened out
       Bravely taking to his feet
       He beat a very brave retreat
       Bravest of the brave Sir Robin
       Petrified of being dead
       Soiled his pants then brave Sir Robin
       Turned away and fled.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///