summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0114
blob: d6f78f5ac1c363c2d1fe1ccab0ba0f34be597e68 (plain)
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0114
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.0114
Problem:    Confusing variable name.
Solution:   Rename new_ts to new_vts_array.  Change zero to NULL.
Files:	    src/ex_cmds.c, src/option.c


*** ../vim-8.1.0113/src/ex_cmds.c	2018-06-24 16:53:31.649909925 +0200
--- src/ex_cmds.c	2018-06-24 22:04:12.929793169 +0200
***************
*** 678,684 ****
      char_u	*new_line = (char_u *)1;    /* init to non-NULL */
      int		did_undo;		/* called u_save for current line */
  #ifdef FEAT_VARTABS
!     int		*new_ts = 0;
      char_u	*new_ts_str;		/* string value of tab argument */
  #else
      int		temp;
--- 678,684 ----
      char_u	*new_line = (char_u *)1;    /* init to non-NULL */
      int		did_undo;		/* called u_save for current line */
  #ifdef FEAT_VARTABS
!     int		*new_vts_array = NULL;
      char_u	*new_ts_str;		/* string value of tab argument */
  #else
      int		temp;
***************
*** 693,708 ****
  
  #ifdef FEAT_VARTABS
      new_ts_str = eap->arg;
!     if (!tabstop_set(eap->arg, &new_ts))
  	return;
      while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',')
  	++(eap->arg);
  
!     // This ensures that either new_ts and new_ts_str are freshly allocated,
!     // or new_ts points to an existing array and new_ts_str is null.
!     if (new_ts == 0)
      {
! 	new_ts = curbuf->b_p_vts_array;
  	new_ts_str = NULL;
      }
      else
--- 693,709 ----
  
  #ifdef FEAT_VARTABS
      new_ts_str = eap->arg;
!     if (!tabstop_set(eap->arg, &new_vts_array))
  	return;
      while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',')
  	++(eap->arg);
  
!     // This ensures that either new_vts_array and new_ts_str are freshly
!     // allocated, or new_vts_array points to an existing array and new_ts_str
!     // is null.
!     if (new_vts_array == NULL)
      {
! 	new_vts_array = curbuf->b_p_vts_array;
  	new_ts_str = NULL;
      }
      else
***************
*** 753,761 ****
  			int t, s;
  
  			tabstop_fromto(start_vcol, vcol,
! 				       tabstop_count(new_ts)? 0: curbuf->b_p_ts,
! 				       new_ts,
! 				       &t, &s);
  			num_tabs = t;
  			num_spaces = s;
  #else
--- 754,760 ----
  			int t, s;
  
  			tabstop_fromto(start_vcol, vcol,
! 					curbuf->b_p_ts, new_vts_array, &t, &s);
  			num_tabs = t;
  			num_spaces = s;
  #else
***************
*** 829,839 ****
      // If a single value was given then it can be considered equal to
      // either the value of 'tabstop' or the value of 'vartabstop'.
      if (tabstop_count(curbuf->b_p_vts_array) == 0
! 	&& tabstop_count(new_ts) == 1
! 	&& curbuf->b_p_ts == tabstop_first(new_ts))
  	; /* not changed */
      else if (tabstop_count(curbuf->b_p_vts_array) > 0
!         && tabstop_eq(curbuf->b_p_vts_array, new_ts))
  	; /* not changed */
      else
  	redraw_curbuf_later(NOT_VALID);
--- 828,838 ----
      // If a single value was given then it can be considered equal to
      // either the value of 'tabstop' or the value of 'vartabstop'.
      if (tabstop_count(curbuf->b_p_vts_array) == 0
! 	&& tabstop_count(new_vts_array) == 1
! 	&& curbuf->b_p_ts == tabstop_first(new_vts_array))
  	; /* not changed */
      else if (tabstop_count(curbuf->b_p_vts_array) > 0
!         && tabstop_eq(curbuf->b_p_vts_array, new_vts_array))
  	; /* not changed */
      else
  	redraw_curbuf_later(NOT_VALID);
***************
*** 853,872 ****
  	// than one tabstop then update 'vartabstop'.
  	int *old_vts_ary = curbuf->b_p_vts_array;
  
! 	if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_ts) > 1)
  	{
  	    set_string_option_direct((char_u *)"vts", -1, new_ts_str,
  							OPT_FREE|OPT_LOCAL, 0);
  	    vim_free(new_ts_str);
! 	    curbuf->b_p_vts_array = new_ts;
  	    vim_free(old_vts_ary);
  	}
  	else
  	{
  	    // 'vartabstop' wasn't in use and a single value was given to
  	    // retab then update 'tabstop'.
! 	    curbuf->b_p_ts = tabstop_first(new_ts);
! 	    vim_free(new_ts);
  	}
      }
  #else
--- 852,871 ----
  	// than one tabstop then update 'vartabstop'.
  	int *old_vts_ary = curbuf->b_p_vts_array;
  
! 	if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1)
  	{
  	    set_string_option_direct((char_u *)"vts", -1, new_ts_str,
  							OPT_FREE|OPT_LOCAL, 0);
  	    vim_free(new_ts_str);
! 	    curbuf->b_p_vts_array = new_vts_array;
  	    vim_free(old_vts_ary);
  	}
  	else
  	{
  	    // 'vartabstop' wasn't in use and a single value was given to
  	    // retab then update 'tabstop'.
! 	    curbuf->b_p_ts = tabstop_first(new_vts_array);
! 	    vim_free(new_vts_array);
  	}
      }
  #else
*** ../vim-8.1.0113/src/option.c	2018-06-24 15:14:02.224061917 +0200
--- src/option.c	2018-06-24 22:03:45.413912296 +0200
***************
*** 12844,12850 ****
      int		t;
      int         excess;
  
!     if (vts == 0 || vts[0] == 0)
  	return (col / ts) * ts;
  
      tabcount = vts[0];
--- 12844,12850 ----
      int		t;
      int         excess;
  
!     if (vts == NULL || vts[0] == 0)
  	return (col / ts) * ts;
  
      tabcount = vts[0];
***************
*** 12878,12887 ****
      int		tabcount;
      int		t;
  
!     if (vts == 0 || vts[0] == 0)
      {
  	int tabs = 0;
  	int initspc = ts - (start_col % ts);
  	if (spaces >= initspc)
  	{
  	    spaces -= initspc;
--- 12878,12888 ----
      int		tabcount;
      int		t;
  
!     if (vts == NULL || vts[0] == 0)
      {
  	int tabs = 0;
  	int initspc = ts - (start_col % ts);
+ 
  	if (spaces >= initspc)
  	{
  	    spaces -= initspc;
*** ../vim-8.1.0113/src/version.c	2018-06-24 19:23:59.989047923 +0200
--- src/version.c	2018-06-24 22:05:27.937462580 +0200
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     114,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
109. You actually read -- and enjoy -- lists like this.

 /// 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    ///