0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.1431: popup window listed as "Scratch"

Problem:    Popup window listed as "Scratch".
Solution:   List them as "Popup".
This commit is contained in:
Bram Moolenaar 2019-05-30 22:32:34 +02:00
parent 402502d0e4
commit c6896e20f8
6 changed files with 24 additions and 5 deletions

View File

@ -85,11 +85,11 @@ Probably 2. is the best choice.
IMPLEMENTATION: IMPLEMENTATION:
- Code is in popupwin.c - Code is in popupwin.c
- Implement the "pos" option.
- Implement filter. - Implement filter.
Check that popup_close() works in the filter. Check that popup_close() works in the filter.
- Implement padding
- Implement border
- Handle screen resize in screenalloc(). - Handle screen resize in screenalloc().
- show [Popup] instead of [Scratch] in ":ls!"
- Make redrawing more efficient and avoid flicker. - Make redrawing more efficient and avoid flicker.
Store popup info in a mask, use the mask in screen_line() Store popup info in a mask, use the mask in screen_line()
Fix redrawing problem with completion. Fix redrawing problem with completion.
@ -287,6 +287,8 @@ Options can be set on the window with `setwinvar()`, e.g.: >
call setwinvar(winid, '&wrap', 0) call setwinvar(winid, '&wrap', 0)
And options can be set on the buffer with `setbufvar()`, e.g.: > And options can be set on the buffer with `setbufvar()`, e.g.: >
call setbufvar(winbufnr(winid), '&filetype', 'java') call setbufvar(winbufnr(winid), '&filetype', 'java')
Note that this does not trigger autocommands. Use `win_execute()` if you do
need them.
POPUP_CREATE() ARGUMENTS *popup_create-usage* POPUP_CREATE() ARGUMENTS *popup_create-usage*
@ -320,7 +322,6 @@ The second argument of |popup_create()| is a dictionary with options:
Alternatively "center" can be used to position the Alternatively "center" can be used to position the
popup in the center of the Vim window, in which case popup in the center of the Vim window, in which case
"line" and "col" are ignored. "line" and "col" are ignored.
{not implemented yet}
flip when TRUE (the default) and the position is relative flip when TRUE (the default) and the position is relative
to the cursor, flip to below or above the cursor to to the cursor, flip to below or above the cursor to
avoid overlap with the |popupmenu-completion| or avoid overlap with the |popupmenu-completion| or
@ -342,7 +343,6 @@ The second argument of |popup_create()| is a dictionary with options:
popup, on top of any border popup, on top of any border
{not implemented yet} {not implemented yet}
wrap TRUE to make the lines wrap (default TRUE) wrap TRUE to make the lines wrap (default TRUE)
{not implemented yet}
highlight highlight group name to use for the text, stored in highlight highlight group name to use for the text, stored in
the 'wincolor' option the 'wincolor' option
padding list with numbers, defining the padding padding list with numbers, defining the padding

View File

@ -1,4 +1,4 @@
*windows.txt* For Vim version 8.1. Last change: 2019 May 18 *windows.txt* For Vim version 8.1. Last change: 2019 May 30
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1030,6 +1030,13 @@ list of buffers. |unlisted-buffer|
thus you can always go to a specific buffer with ":buffer N" thus you can always go to a specific buffer with ":buffer N"
or "N CTRL-^", where N is the buffer number. or "N CTRL-^", where N is the buffer number.
For the file name these special values are used:
[Prompt] |prompt-buffer|
[Popup] buffer of a |popup-window|
[Scratch] 'buftype' is "nofile"
[No Name] no file name specified
For a |terminal-window| buffer the status is used.
Indicators (chars in the same column are mutually exclusive): Indicators (chars in the same column are mutually exclusive):
u an unlisted buffer (only displayed when [!] is used) u an unlisted buffer (only displayed when [!] is used)
|unlisted-buffer| |unlisted-buffer|

View File

@ -5781,6 +5781,10 @@ buf_spname(buf_T *buf)
#ifdef FEAT_JOB_CHANNEL #ifdef FEAT_JOB_CHANNEL
if (bt_prompt(buf)) if (bt_prompt(buf))
return (char_u *)_("[Prompt]"); return (char_u *)_("[Prompt]");
#endif
#ifdef FEAT_TEXT_PROP
if (bt_popup(buf))
return (char_u *)_("[Popup]");
#endif #endif
return (char_u *)_("[Scratch]"); return (char_u *)_("[Scratch]");
} }

View File

@ -550,6 +550,7 @@ f_popup_hide(typval_T *argvars, typval_T *rettv UNUSED)
if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) == 0) if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) == 0)
{ {
wp->w_popup_flags |= POPF_HIDDEN; wp->w_popup_flags |= POPF_HIDDEN;
--wp->w_buffer->b_nwindows;
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
} }
} }
@ -566,6 +567,7 @@ f_popup_show(typval_T *argvars, typval_T *rettv UNUSED)
if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) != 0) if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) != 0)
{ {
wp->w_popup_flags &= ~POPF_HIDDEN; wp->w_popup_flags &= ~POPF_HIDDEN;
++wp->w_buffer->b_nwindows;
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
} }
} }

View File

@ -196,12 +196,16 @@ func Test_popup_hide()
let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
call assert_equal('world', line) call assert_equal('world', line)
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
" buffer is still listed and active
call assert_match(winbufnr(winid) .. 'u a.*\[Popup\]', execute('ls u'))
call popup_hide(winid) call popup_hide(winid)
redraw redraw
let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
call assert_equal('hello', line) call assert_equal('hello', line)
call assert_equal(0, popup_getpos(winid).visible) call assert_equal(0, popup_getpos(winid).visible)
" buffer is still listed but hidden
call assert_match(winbufnr(winid) .. 'u h.*\[Popup\]', execute('ls u'))
call popup_show(winid) call popup_show(winid)
redraw redraw

View File

@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1431,
/**/ /**/
1430, 1430,
/**/ /**/