mirror of
https://github.com/vim/vim.git
synced 2025-11-06 10:07:45 -05:00
patch 8.1.1902: cannot have an info popup without a border
Problem: Cannot have an info popup without a border. Solution: Add the "border" item to 'completepopup'.
This commit is contained in:
@@ -745,6 +745,7 @@ pum_set_selected(int n, int repeat)
|
|||||||
if (use_popup)
|
if (use_popup)
|
||||||
{
|
{
|
||||||
int col = pum_col + pum_width + 1;
|
int col = pum_col + pum_width + 1;
|
||||||
|
int row = pum_row + pum_selected - pum_first + 1;
|
||||||
|
|
||||||
if (Columns - col < 20 && Columns - col < pum_col)
|
if (Columns - col < 20 && Columns - col < pum_col)
|
||||||
{
|
{
|
||||||
@@ -755,8 +756,8 @@ pum_set_selected(int n, int repeat)
|
|||||||
else
|
else
|
||||||
curwin->w_maxwidth = Columns - col + 1;
|
curwin->w_maxwidth = Columns - col + 1;
|
||||||
curwin->w_maxwidth -= popup_extra_width(curwin);
|
curwin->w_maxwidth -= popup_extra_width(curwin);
|
||||||
popup_set_wantpos_rowcol(curwin,
|
row -= popup_top_extra(curwin);
|
||||||
pum_row + pum_selected - pum_first, col);
|
popup_set_wantpos_rowcol(curwin, row, col);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
if (!resized
|
if (!resized
|
||||||
|
|||||||
@@ -935,7 +935,7 @@ add_popup_dicts(buf_T *buf, list_T *l)
|
|||||||
/*
|
/*
|
||||||
* Get the padding plus border at the top, adjusted to 1 if there is a title.
|
* Get the padding plus border at the top, adjusted to 1 if there is a title.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
popup_top_extra(win_T *wp)
|
popup_top_extra(win_T *wp)
|
||||||
{
|
{
|
||||||
int extra = wp->w_popup_border[0] + wp->w_popup_padding[0];
|
int extra = wp->w_popup_border[0] + wp->w_popup_padding[0];
|
||||||
@@ -1350,6 +1350,24 @@ parse_popup_option(win_T *wp, int is_preview)
|
|||||||
*p = c;
|
*p = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (STRNCMP(s, "border:", 7) == 0)
|
||||||
|
{
|
||||||
|
char_u *arg = s + 7;
|
||||||
|
int on = STRNCMP(arg, "on", 2) == 0 && arg + 2 == p;
|
||||||
|
int off = STRNCMP(arg, "off", 3) == 0 && arg + 3 == p;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!on && !off)
|
||||||
|
return FAIL;
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < 4; ++i)
|
||||||
|
wp->w_popup_border[i] = on ? 1 : 0;
|
||||||
|
if (off)
|
||||||
|
// only show the X for close when there is a border
|
||||||
|
wp->w_popup_close = POPCLOSE_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ void popup_drag(win_T *wp);
|
|||||||
void popup_set_firstline(win_T *wp);
|
void popup_set_firstline(win_T *wp);
|
||||||
int popup_is_in_scrollbar(win_T *wp, int row, int col);
|
int popup_is_in_scrollbar(win_T *wp, int row, int col);
|
||||||
void popup_handle_scrollbar_click(win_T *wp, int row, int col);
|
void popup_handle_scrollbar_click(win_T *wp, int row, int col);
|
||||||
|
int popup_top_extra(win_T *wp);
|
||||||
int popup_height(win_T *wp);
|
int popup_height(win_T *wp);
|
||||||
int popup_width(win_T *wp);
|
int popup_width(win_T *wp);
|
||||||
int popup_extra_width(win_T *wp);
|
int popup_extra_width(win_T *wp);
|
||||||
|
|||||||
14
src/testdir/dumps/Test_popupwin_infopopup_nb_1.dump
Normal file
14
src/testdir/dumps/Test_popupwin_infopopup_nb_1.dump
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|a|w|o|r|d> @43
|
||||||
|
|~+0#4040ff13&| @23| +0#0000001#e0e0e08|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| @1|w|o|r|d|s| |a|r|e| |c|o@1|l| | +0#4040ff13#ffffff0@11
|
||||||
|
|~| @23| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
|
||||||
|
|~| @23| +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
|
||||||
|
|~| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|-+2#0000000&@1| |U|s|e|r| |d|e|f|i|n|e|d| |c|o|m|p|l|e|t|i|o|n| |(|^|U|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
|
||||||
@@ -78,7 +78,7 @@ let test_values = {
|
|||||||
\ 'complete': [['', 'w,b'], ['xxx']],
|
\ 'complete': [['', 'w,b'], ['xxx']],
|
||||||
\ 'concealcursor': [['', 'n', 'nvic'], ['xxx']],
|
\ 'concealcursor': [['', 'n', 'nvic'], ['xxx']],
|
||||||
\ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']],
|
\ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']],
|
||||||
\ 'completepopup': [['', 'height:13', 'highlight:That', 'width:10,height:234,highlight:Mine'], ['height:yes', 'width:no', 'xxx', 'xxx:99']],
|
\ 'completepopup': [['', 'height:13', 'highlight:That', 'width:10,height:234,highlight:Mine'], ['height:yes', 'width:no', 'xxx', 'xxx:99', 'border:maybe', 'border:1']],
|
||||||
\ 'completeslash': [['', 'slash', 'backslash'], ['xxx']],
|
\ 'completeslash': [['', 'slash', 'backslash'], ['xxx']],
|
||||||
\ 'cryptmethod': [['', 'zip'], ['xxx']],
|
\ 'cryptmethod': [['', 'zip'], ['xxx']],
|
||||||
\ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']],
|
\ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']],
|
||||||
|
|||||||
@@ -2193,14 +2193,11 @@ func Test_previewpopup()
|
|||||||
call delete('Xheader.h')
|
call delete('Xheader.h')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_popupmenu_info()
|
func Get_popupmenu_lines()
|
||||||
CheckScreendump
|
|
||||||
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
set completeopt+=preview,popup
|
set completeopt+=preview,popup
|
||||||
set completefunc=CompleteFuncDict
|
set completefunc=CompleteFuncDict
|
||||||
hi InfoPopup ctermbg=yellow
|
hi InfoPopup ctermbg=yellow
|
||||||
set completepopup=height:4,highlight:InfoPopup
|
|
||||||
|
|
||||||
func CompleteFuncDict(findstart, base)
|
func CompleteFuncDict(findstart, base)
|
||||||
if a:findstart
|
if a:findstart
|
||||||
@@ -2249,7 +2246,16 @@ func Test_popupmenu_info()
|
|||||||
endfunc
|
endfunc
|
||||||
call setline(1, 'text text text text text text text ')
|
call setline(1, 'text text text text text text text ')
|
||||||
END
|
END
|
||||||
|
return lines
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_popupmenu_info_border()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines = Get_popupmenu_lines()
|
||||||
|
call add(lines, 'set completepopup=height:4,highlight:InfoPopup')
|
||||||
call writefile(lines, 'XtestInfoPopup')
|
call writefile(lines, 'XtestInfoPopup')
|
||||||
|
|
||||||
let buf = RunVimInTerminal('-S XtestInfoPopup', #{rows: 14})
|
let buf = RunVimInTerminal('-S XtestInfoPopup', #{rows: 14})
|
||||||
call term_wait(buf, 50)
|
call term_wait(buf, 50)
|
||||||
|
|
||||||
@@ -2269,4 +2275,21 @@ func Test_popupmenu_info()
|
|||||||
call delete('XtestInfoPopup')
|
call delete('XtestInfoPopup')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_popupmenu_info_noborder()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines = Get_popupmenu_lines()
|
||||||
|
call add(lines, 'set completepopup=height:4,border:off')
|
||||||
|
call writefile(lines, 'XtestInfoPopupNb')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XtestInfoPopupNb', #{rows: 14})
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "A\<C-X>\<C-U>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_infopopup_nb_1', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XtestInfoPopupNb')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2
|
" vim: shiftwidth=2 sts=2
|
||||||
|
|||||||
@@ -761,6 +761,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 */
|
||||||
|
/**/
|
||||||
|
1902,
|
||||||
/**/
|
/**/
|
||||||
1901,
|
1901,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user