summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1421
blob: 82bcb12845f42421baf5e2615f8a3f0870f593b7 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1421
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.1421
Problem:    Drawing "~" line in popup window.
Solution:   Just draw text in the last line of the popup window.
Files:	    src/screen.c, src/structs.h, src/popupwin.c,
            src/proto/popupwin.pro, src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popupwin_05.dump,
            src/testdir/dumps/Test_popupwin_06.dump

*** ../vim-8.1.1420/src/screen.c	2019-05-29 22:28:25.763184805 +0200
--- src/screen.c	2019-05-30 00:07:36.461352821 +0200
***************
*** 1030,1035 ****
--- 1030,1041 ----
  
  	if (lowest_wp == NULL)
  	    break;
+ 
+ 	// Recompute the position if the text changed.
+ 	if (lowest_wp->w_popup_last_changedtick
+ 					   != CHANGEDTICK(lowest_wp->w_buffer))
+ 	    popup_adjust_position(lowest_wp);
+ 
  	win_update(lowest_wp);
  	lowest_wp->w_popup_flags |= POPF_REDRAWN;
      }
***************
*** 2119,2124 ****
--- 2125,2133 ----
  		    && wp->w_lines[idx].wl_lnum == lnum
  		    && lnum > wp->w_topline
  		    && !(dy_flags & (DY_LASTLINE | DY_TRUNCATE))
+ #ifdef FEAT_TEXT_PROP
+ 		    && !bt_popup(wp->w_buffer)
+ #endif
  		    && srow + wp->w_lines[idx].wl_size > wp->w_height
  #ifdef FEAT_DIFF
  		    && diff_check_fill(wp, lnum) == 0
***************
*** 2274,2279 ****
--- 2283,2295 ----
  	    wp->w_filler_rows = wp->w_height - srow;
  	}
  #endif
+ #ifdef FEAT_TEXT_PROP
+ 	else if (bt_popup(wp->w_buffer))
+ 	{
+ 	    // popup line that doesn't fit is left as-is
+ 	    wp->w_botline = lnum;
+ 	}
+ #endif
  	else if (dy_flags & DY_TRUNCATE)	/* 'display' has "truncate" */
  	{
  	    int scr_row = W_WINROW(wp) + wp->w_height - 1;
***************
*** 2334,2340 ****
  
  	// Make sure the rest of the screen is blank
  	// put '~'s on rows that aren't part of the file.
! 	win_draw_end(wp, '~', ' ', FALSE, row, wp->w_height, HLF_EOB);
      }
  
  #ifdef SYN_TIME_LIMIT
--- 2350,2360 ----
  
  	// Make sure the rest of the screen is blank
  	// put '~'s on rows that aren't part of the file.
! 	win_draw_end(wp,
! #ifdef FEAT_TEXT_PROP
! 		bt_popup(wp->w_buffer) ? ' ' :
! #endif
! 				  '~', ' ', FALSE, row, wp->w_height, HLF_EOB);
      }
  
  #ifdef SYN_TIME_LIMIT
*** ../vim-8.1.1420/src/structs.h	2019-05-27 23:36:17.456452208 +0200
--- src/structs.h	2019-05-29 23:55:07.389119328 +0200
***************
*** 2881,2886 ****
--- 2881,2888 ----
      int		w_maxwidth;	    // "maxwidth" for popup window
      int		w_wantline;	    // "line" for popup window
      int		w_wantcol;	    // "col" for popup window
+     varnumber_T	w_popup_last_changedtick; // b:changedtick when position was
+ 					  // computed
  # if defined(FEAT_TIMERS)
      timer_T	*w_popup_timer;	    // timer for closing popup window
  # endif
*** ../vim-8.1.1420/src/popupwin.c	2019-05-29 23:14:25.401172162 +0200
--- src/popupwin.c	2019-05-30 00:07:32.617372125 +0200
***************
*** 151,157 ****
  /*
   * Adjust the position and size of the popup to fit on the screen.
   */
!     static void
  popup_adjust_position(win_T *wp)
  {
      linenr_T	lnum;
--- 151,157 ----
  /*
   * Adjust the position and size of the popup to fit on the screen.
   */
!     void
  popup_adjust_position(win_T *wp)
  {
      linenr_T	lnum;
***************
*** 209,214 ****
--- 209,216 ----
  	wp->w_height = wp->w_maxheight;
      if (wp->w_height > Rows - wp->w_winrow)
  	wp->w_height = Rows - wp->w_winrow;
+ 
+     wp->w_popup_last_changedtick = CHANGEDTICK(wp->w_buffer);
  }
  
  /*
*** ../vim-8.1.1420/src/proto/popupwin.pro	2019-05-29 20:26:32.525530253 +0200
--- src/proto/popupwin.pro	2019-05-29 23:58:15.652171411 +0200
***************
*** 1,13 ****
  /* popupwin.c */
  void f_popup_create(typval_T *argvars, typval_T *rettv);
  int popup_any_visible(void);
  void f_popup_close(typval_T *argvars, typval_T *rettv);
  void f_popup_hide(typval_T *argvars, typval_T *rettv);
- void f_popup_getposition(typval_T *argvars, typval_T *rettv);
  void f_popup_show(typval_T *argvars, typval_T *rettv);
  void popup_close(int id);
  void popup_close_tabpage(tabpage_T *tp, int id);
  void close_all_popups(void);
  void ex_popupclear(exarg_T *eap);
  void f_popup_move(typval_T *argvars, typval_T *rettv);
  /* vim: set ft=c : */
--- 1,14 ----
  /* popupwin.c */
+ void popup_adjust_position(win_T *wp);
  void f_popup_create(typval_T *argvars, typval_T *rettv);
  int popup_any_visible(void);
  void f_popup_close(typval_T *argvars, typval_T *rettv);
  void f_popup_hide(typval_T *argvars, typval_T *rettv);
  void f_popup_show(typval_T *argvars, typval_T *rettv);
  void popup_close(int id);
  void popup_close_tabpage(tabpage_T *tp, int id);
  void close_all_popups(void);
  void ex_popupclear(exarg_T *eap);
  void f_popup_move(typval_T *argvars, typval_T *rettv);
+ void f_popup_getposition(typval_T *argvars, typval_T *rettv);
  /* vim: set ft=c : */
*** ../vim-8.1.1420/src/testdir/test_popupwin.vim	2019-05-29 23:14:25.401172162 +0200
--- src/testdir/test_popupwin.vim	2019-05-30 00:09:27.736794071 +0200
***************
*** 41,51 ****
    call term_sendkeys(buf, ":quit!\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_04', {})
  
!   " resize popup
    call term_sendkeys(buf, ":call popup_move(popupwin, {'minwidth': 15, 'maxwidth': 25, 'minheight': 3, 'maxheight': 5})\<CR>")
    call term_sendkeys(buf, ":redraw\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_05', {})
  
    " clean up
    call StopVimInTerminal(buf)
    call delete('XtestPopup')
--- 41,56 ----
    call term_sendkeys(buf, ":quit!\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_04', {})
  
!   " resize popup, show empty line at bottom
    call term_sendkeys(buf, ":call popup_move(popupwin, {'minwidth': 15, 'maxwidth': 25, 'minheight': 3, 'maxheight': 5})\<CR>")
    call term_sendkeys(buf, ":redraw\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_05', {})
  
+   " show not fitting line at bottom
+   call term_sendkeys(buf, ":call setbufline(winbufnr(popupwin), 3, 'this line will not fit here')\<CR>")
+   call term_sendkeys(buf, ":redraw\<CR>")
+   call VerifyScreenDump(buf, 'Test_popupwin_06', {})
+ 
    " clean up
    call StopVimInTerminal(buf)
    call delete('XtestPopup')
*** ../vim-8.1.1420/src/testdir/dumps/Test_popupwin_05.dump	2019-05-27 21:53:53.990229301 +0200
--- src/testdir/dumps/Test_popupwin_05.dump	2019-05-29 23:36:51.574682812 +0200
***************
*** 3,9 ****
  |~| @73
  |~| @6|o+0#0000001#ffd7ff255|t|h|e|r| |t|a|b| @5| +0#4040ff13#ffffff0@51
  |~| @6|a+0#0000001#ffd7ff255| |c+0#ff404010&|o|m@1|e|n|t| +0#0000001&|l|i|n|e| | +0#4040ff13#ffffff0@51
! |~| @6|~+0&#ffd7ff255| @13| +0&#ffffff0@51
  |~| @73
  |~| @73
  |~| @73
--- 3,9 ----
  |~| @73
  |~| @6|o+0#0000001#ffd7ff255|t|h|e|r| |t|a|b| @5| +0#4040ff13#ffffff0@51
  |~| @6|a+0#0000001#ffd7ff255| |c+0#ff404010&|o|m@1|e|n|t| +0#0000001&|l|i|n|e| | +0#4040ff13#ffffff0@51
! |~| @6| +0&#ffd7ff255@14| +0&#ffffff0@51
  |~| @73
  |~| @73
  |~| @73
*** ../vim-8.1.1420/src/testdir/dumps/Test_popupwin_06.dump	2019-05-30 00:10:59.660332551 +0200
--- src/testdir/dumps/Test_popupwin_06.dump	2019-05-30 00:09:35.280756197 +0200
***************
*** 0 ****
--- 1,10 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @6|o+0#0000001#ffd7ff255|t|h|e|r| |t|a|b| @15| +0#4040ff13#ffffff0@41
+ |~| @6|a+0#0000001#ffd7ff255| |c+0#ff404010&|o|m@1|e|n|t| +0#0000001&|l|i|n|e| @10| +0#4040ff13#ffffff0@41
+ |~| @6|t+0#0000001#ffd7ff255|h|i|s| |l|i|n|e| |w|i|l@1| |n|o|t| |f|i|t| |h|e| +0#4040ff13#ffffff0@41
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#0000000&|r|e|d|r|a|w| @49|0|,|0|-|1| @8|A|l@1| 
*** ../vim-8.1.1420/src/version.c	2019-05-29 23:14:25.401172162 +0200
--- src/version.c	2019-05-29 23:35:38.523045031 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1421,
  /**/


-- 
hundred-and-one symptoms of being an internet addict:
49. You never have to deal with busy signals when calling your ISP...because
    you never log off.

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