summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1364
blob: f7a19d8e8197811f0dc81a626155d2ced62d1a38 (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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1364
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.1364
Problem:    Design for popup window support needs more details.
Solution:   Add details about using a window and buffer.  Rename popup_show()
            to popup_create() and add popup_show() and popup_hide().
Files:	    runtime/doc/popup.txt


*** ../vim-8.1.1363/runtime/doc/popup.txt	2019-05-12 21:43:24.626559005 +0200
--- runtime/doc/popup.txt	2019-05-21 23:06:22.550406101 +0200
***************
*** 1,10 ****
! *popup.txt*  For Vim version 8.1.  Last change: 2019 May 12
  
  
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
  
  
! Displaying text with properties attached.	*popup* *popup-window*
  
  THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE  
  
--- 1,10 ----
! *popup.txt*  For Vim version 8.1.  Last change: 2019 May 21
  
  
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
  
  
! Displaying text in floating window.			*popup* *popup-window*
  
  THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE  
  
***************
*** 13,30 ****
  3. Examples			|popup-examples|
  
  
! {not able to use text properties when the |+textprop| feature was
! disabled at compile time}
  
  ==============================================================================
  1. Introduction						*popup-intro*
  
! We are talking about popup windows here, text that goes on top of the buffer
! text and is under control of a plugin.  Other popup functionality:
  - popup menu, see |popup-menu|
  - balloon, see |balloon-eval|
  
! TODO
  
  ==============================================================================
  2. Functions						*popup-functions*
--- 13,79 ----
  3. Examples			|popup-examples|
  
  
! {not available if the |+eval| feature was disabled at compile time}
! {not able to use text properties if the |+textprop| feature was disabled at
! compile time}
  
  ==============================================================================
  1. Introduction						*popup-intro*
  
! We are talking about popup windows here, text that goes on top of the regular
! windows and is under control of a plugin.  You cannot edit the text in the
! popup window like with regular windows.
! 
! A popup window can be used for such things as:
! - briefly show a message without changing the command line
! - prompt the user with a dialog
! - display information while typing
! - give extra information for auto-completion
! 
! The text in the popup window can be colored with |text-properties|.  It is
! also possible to use syntax highlighting.
! 
! A popup window has a window-ID like other windows, but behaves differently.
! The size can be up to the whole Vim window and it overlaps other windows.
! It contains a buffer, and that buffer is always associated with the popup
! window.  The window cannot be used in Normal, Visual or Insert mode, it does
! not get keyboard focus.  You can use functions like `setbufline()` to change
! the text in the buffer.  There are more differences from how this window and
! buffer behave compared to regular windows and buffers, see |popup-buffer|.
! 
! If this is not what you are looking for, check out other popup functionality:
  - popup menu, see |popup-menu|
  - balloon, see |balloon-eval|
  
! 
! TODO:
! 
! Example how to use syntax highlighting of a code snippet.
! 
! Scrolling: When the screen scrolls up for output of an Ex command, what
! happens with popups?
! 1. Stay where they are.  Problem: listed text may go behind and can't be read.
! 2. Scroll with the page.  What if they get updated?  Either postpone, or take
!    the scroll offset into account.
! Probably 2. is the best choice.
! 
! Positioning relative to the popup-menu to avoid overlapping with it; add a
! function to get the position and size of the popup-menu.
! 
! 
! IMPLEMENTATION:
! - Put code in popupwin.c
! - Use win_update() for displaying
! - At first redraw all windows NOT_VALID when the popup moves or hides.
! - At first always display the popup windows at the end of update_screen(),
!   lowest zindex first.
! - Later make it more efficient and avoid flicker
! - Use a separate list of windows, one for each tab and one global.  Also put
!   "aucmd_win" in there.
! - add optional {buf} command to execute().  Only works for a buffer that is
!   visible in a window in the current tab or in a popup window.
!   E.g. for execute('syntax enable', 'silent', bufnr)
! 
  
  ==============================================================================
  2. Functions						*popup-functions*
***************
*** 33,88 ****
  
  Proposal and discussion on issue #4063: https://github.com/vim/vim/issues/4063
  
! [to be moved to eval.txt later]
! 
! popup_show({lines}, {options})				*popup_show()*
! 		Open a popup window showing {lines}, which is a list of lines,
! 		where each line has text and text properties.
  
  		{options} is a dictionary with many possible entries.
  
! 		Returns a unique ID to be used with |popup_close()|.
! 
! 		See |popup_show-usage| for details.
  
  
! popup_dialog({lines}, {options})			*popup_dialog()*
! 		Just like |popup_show()| but with different default options:
! 			pos		"center"
! 			zindex		200
! 			border		[]
  
  
  popup_notification({text}, {options})			 *popup_notification()*
! 		Show the string {text} for 3 seconds at the top of the Vim
! 		window.  This works like: >
! 			call popup_show([{'text': {text}}], {
  				\ 'line': 1,
  				\ 'col': 10,
  				\ 'time': 3000,
  				\ 'zindex': 200,
  				\ 'highlight': 'WarningMsg',
  				\ 'border: [],
  				\ })
  <		Use {options} to change the properties.
  
  popup_atcursor({text}, {options})			 *popup_atcursor()*
! 		Show the string {text} above the cursor, and close it when the
! 		cursor moves.  This works like: >
! 			call popup_show([{'text': {text}}], {
  				\ 'line': 'cursor-1',
  				\ 'col': 'cursor',
- 				\ 'zindex': 50,
  				\ 'moved': 'WORD',
  				\ })
  <		Use {options} to change the properties.
  
  
! popup_menu({lines}, {options})			 *popup_atcursor()*
! 		Show the {lines} near the cursor, handle selecting one of the
  		items with cursorkeys, and close it an item is selected with
! 		Space or Enter.  This works like: >
! 			call popup_show({lines}, {
  				\ 'pos': 'center',
  				\ 'zindex': 200,
  				\ 'wrap': 0,
--- 82,147 ----
  
  Proposal and discussion on issue #4063: https://github.com/vim/vim/issues/4063
  
! [functions to be moved to eval.txt later, keep list of functions here]
  
+ popup_create({text}, {options})				*popup_create()*
+ 		Open a popup window showing {text}, which is either:
+ 		- a string
+ 		- a list of strings
+ 		- a list of text lines with text properties
  		{options} is a dictionary with many possible entries.
+ 		See |popup_create-usage| for details.
  
! 		Returns a window-ID, which can be used with other popup
! 		functions.  Use `winbufnr()` to get the number of the buffer
! 		in the window: >
! 			let winid = popup_create('hello', {})
! 			let bufnr = winbufnr(winid)
! 			call setbufline(bufnr, 2, 'second line')
  
  
! popup_dialog({text}, {options})				*popup_dialog()*
! 		Just like |popup_create()| but with these default options: >
! 			call popup_create({text}, {
! 				\ 'pos': 'center',
! 				\ 'zindex': 200,
! 				\ 'border': [],
! 				\})
! <		Use {options} to change the properties.
  
  
  popup_notification({text}, {options})			 *popup_notification()*
! 		Show the {text} for 3 seconds at the top of the Vim window.
! 		This works like: >
! 			call popup_create({text}, {
  				\ 'line': 1,
  				\ 'col': 10,
  				\ 'time': 3000,
+ 				\ 'tab': -1,
  				\ 'zindex': 200,
  				\ 'highlight': 'WarningMsg',
  				\ 'border: [],
  				\ })
  <		Use {options} to change the properties.
  
+ 
  popup_atcursor({text}, {options})			 *popup_atcursor()*
! 		Show the {text} above the cursor, and close it when the cursor
! 		moves.  This works like: >
! 			call popup_create({text}, {
  				\ 'line': 'cursor-1',
  				\ 'col': 'cursor',
  				\ 'moved': 'WORD',
  				\ })
  <		Use {options} to change the properties.
  
  
! popup_menu({text}, {options})				 *popup_menu()*
! 		Show the {text} near the cursor, handle selecting one of the
  		items with cursorkeys, and close it an item is selected with
! 		Space or Enter. {text} should have multiple lines to make this
! 		useful.  This works like: >
! 			call popup_create({text}, {
  				\ 'pos': 'center',
  				\ 'zindex': 200,
  				\ 'wrap': 0,
***************
*** 93,101 ****
  		"callback" to a function that handles the selected item.
  
  
  popup_move({id}, {options})					*popup_move()*
  		Move popup {id} to the position speficied with {options}.
! 		{options} may contain the items from |popup_show()| that
  		specify the popup position: "line", "col", "pos", "maxheight",
  		"minheight", "maxwidth" and "minwidth".
  
--- 152,168 ----
  		"callback" to a function that handles the selected item.
  
  
+ popup_show({id})						*popup_show()*
+ 		If {id} is a hidden popup, show it now.
+ 
+ popup_hide({id})						*popup_hide()*
+ 		If {id} is a displayed popup, hide it now. If the popup has a
+ 		filter it will not be invoked for so long as the popup is
+ 		hidden.
+ 
  popup_move({id}, {options})					*popup_move()*
  		Move popup {id} to the position speficied with {options}.
! 		{options} may contain the items from |popup_create()| that
  		specify the popup position: "line", "col", "pos", "maxheight",
  		"minheight", "maxwidth" and "minwidth".
  
***************
*** 116,136 ****
  		pressing 'n'.
  
  
- popup_setlines({id}, {lnum}, {lines})			*popup_setlines()*
- 		In popup {id} set line {lnum} and following to {lines}.
- 
- 		{lnum} is one-based and must be either an existing line or
- 		just one below the last line, in which case the line gets
- 		appended.
- 
- 		{lines} has the same format as one item in {lines} of
- 		|popup_show()|.  Existing lines are replaced. When {lines}
- 		extends below the last line of the popup lines are appended.
- 
- popup_getlines({id})					*popup_getlines()*
- 		Return the {lines} for popup {id}.
- 
- 
  popup_setoptions({id}, {options})			*popup_setoptions()*
  		Override options in popup {id} with entries in {options}.
  
--- 183,188 ----
***************
*** 142,160 ****
  popup_close({id})					*popup_close()*
  		Close popup {id}.
  
! 
! POPUP_SHOW() ARGUMENTS					*popup_show-usage*
! 
! The first argument of |popup_show()| is a list of text lines.  Each item in
! the list is a dictionary with these entries:
! 	text		The text to display.
  	props		A list of text properties.  Optional.
  			Each entry is a dictionary, like the third argument of
  			|prop_add()|, but specifying the column in the
  			dictionary with a "col" entry, see below:
  			|popup-props|.
  
! The second argument of |popup_show()| is a dictionary with options:
  	line		screen line where to position the popup; can use
  			"cursor", "cursor+1" or "cursor-1" to use the line of
  			the cursor and add or subtract a number of lines;
--- 194,239 ----
  popup_close({id})					*popup_close()*
  		Close popup {id}.
  
! 							*:popupclear* *:popupc*
! :popupc[lear]	Emergency solution to a misbehaving plugin: close all popup
! 		windows.
! 
! 
! POPUP BUFFER AND WINDOW					*popup-buffer*
! 
! A new buffer is created to hold the text and text properties of the popup
! window.  The buffer is always associated with the popup window and
! manipulation is restricted:
! - the buffer has no name
! - 'buftype' is "popup" 
! - 'swapfile' is off
! - 'bufhidden' is "hide"
! - 'buflisted' is off
! TODO: more
! 
! The window does have a cursor position, but the cursor is not displayed.
! 
! Options can be set on the window with `setwinvar()`, e.g.: >
! 	call setwinvar(winid, '&wrap', 0)
! And options can be set on the buffer with `setbufvar()`, e.g.: >
! 	call setbufvar(winbufnr(winid), '&filetype', 'java')
! 
! 
! POPUP_CREATE() ARGUMENTS				*popup_create-usage*
! 
! The first argument of |popup_create()| specifies the text to be displayed, and
! optionally text properties.  It is in one of three forms:
! - a string
! - a list of strings
! - a list of dictionaries, where each dictionary has these entries:
! 	text		String with the text to display.
  	props		A list of text properties.  Optional.
  			Each entry is a dictionary, like the third argument of
  			|prop_add()|, but specifying the column in the
  			dictionary with a "col" entry, see below:
  			|popup-props|.
  
! The second argument of |popup_create()| is a dictionary with options:
  	line		screen line where to position the popup; can use
  			"cursor", "cursor+1" or "cursor-1" to use the line of
  			the cursor and add or subtract a number of lines;
***************
*** 168,177 ****
--- 247,266 ----
  			used for.  Default is "botleft".  Alternatively
  			"center" can be used to position the popup somewhere
  			near the cursor.
+ 	flip		when TRUE (the default) and the position is relative
+ 			to the cursor, flip to below or above the cursor to
+ 			avoid overlap with the |popupmenu-completion| or
+ 			another popup with a higher "zindex"
  	maxheight	maximum height
  	minheight	minimum height
  	maxwidth	maximum width
  	minwidth	minimum width
+ 	hidden		when TRUE the popup exists but is not displayed; use
+ 			`popup_show()` to unhide it.
+ 	tab		when -1: display the popup on all tabs; when 0 (the
+ 			default): display the popup on the current tab;
+ 			otherwise the number of the tab page the popup is
+ 			displayed on; when invalid the current tab is used
  	title		text to be displayed above the first item in the
  			popup, on top of any border
  	wrap		TRUE to make the lines wrap (default TRUE)
***************
*** 229,237 ****
  
  POPUP FILTER						*popup-filter*
  
! A callback that gets any typed keys while a popup is displayed.  It can return
! TRUE to indicate the key has been handled and is to be discarded, or FALSE to
! let Vim handle the key as usual in the current state.
  
  The filter function is called with two arguments: the ID of the popup and the
  key.
--- 318,328 ----
  
  POPUP FILTER						*popup-filter*
  
! A callback that gets any typed keys while a popup is displayed.  The filter is
! not invoked for as long as the popup is hidden.
! 
! The filter can return TRUE to indicate the key has been handled and is to be
! discarded, or FALSE to let Vim handle the key as usual in the current state.
  
  The filter function is called with two arguments: the ID of the popup and the
  key.
***************
*** 241,246 ****
--- 332,341 ----
  	cursor keys	select another entry
  	Tab		accept current suggestion
  
+ A mouse click arrives as <LeftMouse>.  The coordinates are in
+ v:mouse_popup_col and v:mouse_popup_row.  The top-left screen cell of the
+ popup is col 1, row 1 (not counting the border).
+ 
  Vim provides standard filters |popup_filter_menu()| and
  |popup_filter_yesno()|.
  
***************
*** 265,271 ****
  	   endif
  	endfunc
  
! 	call popup_show([{'text': 'Continue? y/n'}], {
  		\ 'filter': 'popup_filter_yesno',
  		\ 'callback': 'MyDialogHandler',
  		\ })
--- 360,366 ----
  	   endif
  	endfunc
  
! 	call popup_create(['Continue? y/n'], {
  		\ 'filter': 'popup_filter_yesno',
  		\ 'callback': 'MyDialogHandler',
  		\ })
*** ../vim-8.1.1363/src/version.c	2019-05-21 20:54:42.078415244 +0200
--- src/version.c	2019-05-21 23:08:15.613816651 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1364,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
6. You refuse to go to a vacation spot with no electricity and no phone lines.

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