summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0709
blob: db0b58cb21f8631166db4c34af4c8d77ae5b87d5 (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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0709
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.0709
Problem:    Windows are updated for every added/deleted sign.
Solution:   Do not call update_debug_sign().  Only redraw when the line with
            the sign is visible.  (idea from neovim #9479)
Files:	    src/sign.c, src/screen.c, src/proto/screen.pro


*** ../vim-8.1.0708/src/sign.c	2019-01-07 22:09:54.439460880 +0100
--- src/sign.c	2019-01-09 21:39:13.363740272 +0100
***************
*** 327,334 ****
      prev = NULL;
      FOR_ALL_SIGNS_IN_BUF(buf, sign)
      {
! 	if (lnum == sign->lnum && id == sign->id &&
! 		sign_in_group(sign, groupname))
  	{
  	    // Update an existing sign
  	    sign->typenr = typenr;
--- 327,334 ----
      prev = NULL;
      FOR_ALL_SIGNS_IN_BUF(buf, sign)
      {
! 	if (lnum == sign->lnum && id == sign->id
! 		&& sign_in_group(sign, groupname))
  	{
  	    // Update an existing sign
  	    sign->typenr = typenr;
***************
*** 427,435 ****
      for (sign = buf->b_signlist; sign != NULL; sign = next)
      {
  	next = sign->next;
! 	if ((id == 0 || sign->id == id) &&
! 		(atlnum == 0 || sign->lnum == atlnum) &&
! 		sign_in_group(sign, group))
  
  	{
  	    *lastp = next;
--- 427,435 ----
      for (sign = buf->b_signlist; sign != NULL; sign = next)
      {
  	next = sign->next;
! 	if ((id == 0 || sign->id == id)
! 		&& (atlnum == 0 || sign->lnum == atlnum)
! 		&& sign_in_group(sign, group))
  
  	{
  	    *lastp = next;
***************
*** 439,445 ****
  	    if (sign->group != NULL)
  		sign_group_unref(sign->group->sg_name);
  	    vim_free(sign);
! 	    update_debug_sign(buf, lnum);
  	    // Check whether only one sign needs to be deleted
  	    // If deleting a sign with a specific identifer in a particular
  	    // group or deleting any sign at a particular line number, delete
--- 439,446 ----
  	    if (sign->group != NULL)
  		sign_group_unref(sign->group->sg_name);
  	    vim_free(sign);
! 	    redraw_buf_line_later(buf, lnum);
! 
  	    // Check whether only one sign needs to be deleted
  	    // If deleting a sign with a specific identifer in a particular
  	    // group or deleting any sign at a particular line number, delete
***************
*** 453,465 ****
  	    lastp = &sign->next;
      }
  
!     // When deleted the last sign need to redraw the windows to remove the
!     // sign column.
      if (buf->b_signlist == NULL)
-     {
- 	redraw_buf_later(buf, NOT_VALID);
  	changed_cline_bef_curs();
-     }
  
      return lnum;
  }
--- 454,463 ----
  	    lastp = &sign->next;
      }
  
!     // When deleting the last sign the cursor position may change, because the
!     // sign columns no longer shows.
      if (buf->b_signlist == NULL)
  	changed_cline_bef_curs();
  
      return lnum;
  }
***************
*** 932,938 ****
  	// ":sign place {id} file={fname}": change sign type
  	lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr);
      if (lnum > 0)
! 	update_debug_sign(buf, lnum);
      else
      {
  	EMSG2(_("E885: Not possible to change sign %s"), sign_name);
--- 930,936 ----
  	// ":sign place {id} file={fname}": change sign type
  	lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr);
      if (lnum > 0)
! 	redraw_buf_line_later(buf, lnum);
      else
      {
  	EMSG2(_("E885: Not possible to change sign %s"), sign_name);
***************
*** 1068,1075 ****
  	//   :sign place
  	//   :sign place group={group}
  	//   :sign place group=*
! 	if (lnum >= 0 || sign_name != NULL ||
! 		(group != NULL && *group == '\0'))
  	    EMSG(_(e_invarg));
  	else
  	    sign_list_placed(buf, group);
--- 1066,1073 ----
  	//   :sign place
  	//   :sign place group={group}
  	//   :sign place group=*
! 	if (lnum >= 0 || sign_name != NULL
! 		|| (group != NULL && *group == '\0'))
  	    EMSG(_(e_invarg));
  	else
  	    sign_list_placed(buf, group);
***************
*** 1077,1084 ****
      else
      {
  	// Place a new sign
! 	if (sign_name == NULL || buf == NULL ||
! 		(group != NULL && *group == '\0'))
  	{
  	    EMSG(_(e_invarg));
  	    return;
--- 1075,1082 ----
      else
      {
  	// Place a new sign
! 	if (sign_name == NULL || buf == NULL
! 		|| (group != NULL && *group == '\0'))
  	{
  	    EMSG(_(e_invarg));
  	    return;
***************
*** 1174,1181 ****
  	return;
      }
  
!     if (buf == NULL || (group != NULL && *group == '\0') ||
! 					lnum >= 0 || sign_name != NULL)
      {
  	// File or buffer is not specified or an empty group is used
  	// or a line number or a sign name is specified.
--- 1172,1179 ----
  	return;
      }
  
!     if (buf == NULL || (group != NULL && *group == '\0')
! 					     || lnum >= 0 || sign_name != NULL)
      {
  	// File or buffer is not specified or an empty group is used
  	// or a line number or a sign name is specified.
***************
*** 1330,1336 ****
      // If the filename is not supplied for the sign place or the sign jump
      // command, then use the current buffer.
      if (filename == NULL && ((cmd == SIGNCMD_PLACE && lnum_arg)
! 		|| cmd == SIGNCMD_JUMP))
  	*buf = curwin->w_buffer;
  
      return OK;
--- 1328,1334 ----
      // If the filename is not supplied for the sign place or the sign jump
      // command, then use the current buffer.
      if (filename == NULL && ((cmd == SIGNCMD_PLACE && lnum_arg)
! 						       || cmd == SIGNCMD_JUMP))
  	*buf = curwin->w_buffer;
  
      return OK;
***************
*** 1522,1531 ****
      {
  	if (!sign_in_group(sign, sign_group))
  	    continue;
! 	if ((lnum == 0 && sign_id == 0) ||
! 		(sign_id == 0 && lnum == sign->lnum) ||
! 		(lnum == 0 && sign_id == sign->id) ||
! 		(lnum == sign->lnum && sign_id == sign->id))
  	{
  	    if ((sdict = sign_get_info(sign)) != NULL)
  		list_append_dict(l, sdict);
--- 1520,1529 ----
      {
  	if (!sign_in_group(sign, sign_group))
  	    continue;
! 	if ((lnum == 0 && sign_id == 0)
! 		|| (sign_id == 0 && lnum == sign->lnum)
! 		|| (lnum == 0 && sign_id == sign->id)
! 		|| (lnum == sign->lnum && sign_id == sign->id))
  	{
  	    if ((sdict = sign_get_info(sign)) != NULL)
  		list_append_dict(l, sdict);
***************
*** 1864,1871 ****
  	switch (cmd_idx)
  	{
  	    case SIGNCMD_DEFINE:
! 		if (STRNCMP(last, "texthl", p - last) == 0 ||
! 		    STRNCMP(last, "linehl", p - last) == 0)
  		    xp->xp_context = EXPAND_HIGHLIGHT;
  		else if (STRNCMP(last, "icon", p - last) == 0)
  		    xp->xp_context = EXPAND_FILES;
--- 1862,1869 ----
  	switch (cmd_idx)
  	{
  	    case SIGNCMD_DEFINE:
! 		if (STRNCMP(last, "texthl", p - last) == 0
! 			|| STRNCMP(last, "linehl", p - last) == 0)
  		    xp->xp_context = EXPAND_HIGHLIGHT;
  		else if (STRNCMP(last, "icon", p - last) == 0)
  		    xp->xp_context = EXPAND_FILES;
*** ../vim-8.1.0708/src/screen.c	2019-01-09 20:51:00.321398815 +0100
--- src/screen.c	2019-01-09 21:47:15.772416499 +0100
***************
*** 264,269 ****
--- 264,280 ----
  }
  
      void
+ redraw_buf_line_later(buf_T *buf, linenr_T lnum)
+ {
+     win_T	*wp;
+ 
+     FOR_ALL_WINDOWS(wp)
+ 	if (wp->w_buffer == buf && lnum >= wp->w_topline
+ 						  && lnum < wp->w_botline)
+ 	    redrawWinline(wp, lnum);
+ }
+ 
+     void
  redraw_buf_and_status_later(buf_T *buf, int type)
  {
      win_T	*wp;
***************
*** 978,1003 ****
      win_foldinfo.fi_level = 0;
  # endif
  
!     /* update/delete a specific mark */
      FOR_ALL_WINDOWS(wp)
-     {
- 	if (buf != NULL && lnum > 0)
- 	{
- 	    if (wp->w_buffer == buf && lnum >= wp->w_topline
- 						      && lnum < wp->w_botline)
- 	    {
- 		if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
- 		    wp->w_redraw_top = lnum;
- 		if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
- 		    wp->w_redraw_bot = lnum;
- 		redraw_win_later(wp, VALID);
- 	    }
- 	}
- 	else
- 	    redraw_win_later(wp, VALID);
  	if (wp->w_redr_type != 0)
  	    doit = TRUE;
-     }
  
      /* Return when there is nothing to do, screen updating is already
       * happening (recursive call), messages on the screen or still starting up.
--- 989,1001 ----
      win_foldinfo.fi_level = 0;
  # endif
  
!     // update/delete a specific sign
!     redraw_buf_line_later(buf, lnum);
! 
!     // check if it resulted in the need to redraw a window
      FOR_ALL_WINDOWS(wp)
  	if (wp->w_redr_type != 0)
  	    doit = TRUE;
  
      /* Return when there is nothing to do, screen updating is already
       * happening (recursive call), messages on the screen or still starting up.
*** ../vim-8.1.0708/src/proto/screen.pro	2019-01-09 20:51:00.321398815 +0100
--- src/proto/screen.pro	2019-01-09 21:39:29.319633988 +0100
***************
*** 5,10 ****
--- 5,11 ----
  void redraw_all_later(int type);
  void redraw_curbuf_later(int type);
  void redraw_buf_later(buf_T *buf, int type);
+ void redraw_buf_line_later(buf_T *buf, linenr_T lnum);
  void redraw_buf_and_status_later(buf_T *buf, int type);
  int redraw_asap(int type);
  void redraw_after_callback(int call_update_screen);
*** ../vim-8.1.0708/src/version.c	2019-01-09 20:51:00.321398815 +0100
--- src/version.c	2019-01-09 21:25:07.452472773 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     709,
  /**/

-- 
The coffee just wasn't strong enough to defend itself -- Tom Waits

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