vim-patch:8.0.1495: having 'pumwidth' default to zero has no merit

Problem:    Having 'pumwidth' default to zero has no merit.
Solution:   Make the default 15, as the actual default value.
42443c7d7f

Includes 'pumwidth' documentation changes from 8.0.1531.
Sort 'pum*' option in alphabetical order.
This commit is contained in:
Jan Edmund Lazo 2019-09-10 18:54:31 -04:00
parent 703ed11c97
commit 669d675ef3
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
4 changed files with 38 additions and 47 deletions

View File

@ -4524,20 +4524,6 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When on a ":" prompt is used in Ex mode.
*'pumheight'* *'ph'*
'pumheight' 'ph' number (default 0)
global
Determines the maximum number of items to show in the popup menu for
Insert mode completion. When zero as much space as available is used.
|ins-completion-menu|.
*'pumwidth'* *'pw'*
'pumwidth' 'pw' number (default 0)
global
Determines the minium width to use for the popup menu for Insert mode
completion. When zero the default of 15 screen cells is used.
|ins-completion-menu|.
*'pumblend'* *'pb'*
'pumblend' 'pb' number (default 0)
global
@ -4554,6 +4540,19 @@ A jump table for the options with a short description can be found at |Q_op|.
<
UI-dependent. Works best with RGB colors. 'termguicolors'
*'pumheight'* *'ph'*
'pumheight' 'ph' number (default 0)
global
Determines the maximum number of items to show in the popup menu for
Insert mode completion. When zero as much space as available is used.
|ins-completion-menu|.
*'pumwidth'* *'pw'*
'pumwidth' 'pw' number (default 15)
global
Determines the minium width to use for the popup menu for Insert mode
completion. |ins-completion-menu|.
*'pyxversion'* *'pyx'*
'pyxversion' 'pyx' number (default depends on the build)
global

View File

@ -371,9 +371,9 @@ EXTERN long p_columns; // 'columns'
EXTERN int p_confirm; // 'confirm'
EXTERN int p_cp; // 'compatible'
EXTERN char_u *p_cot; // 'completeopt'
EXTERN long p_pb; // 'pumblend'
EXTERN long p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth'
EXTERN long p_pb; // 'pumblend'
EXTERN char_u *p_cpo; // 'cpoptions'
EXTERN char_u *p_csprg; // 'cscopeprg'
EXTERN int p_csre; // 'cscoperelative'

View File

@ -1815,6 +1815,14 @@ return {
varname='p_prompt',
defaults={if_true={vi=true}}
},
{
full_name='pumblend', abbreviation='pb',
type='number', scope={'global'},
vi_def=true,
redraw={'ui_option'},
varname='p_pb',
defaults={if_true={vi=0}}
},
{
full_name='pumheight', abbreviation='ph',
type='number', scope={'global'},
@ -1827,15 +1835,7 @@ return {
type='number', scope={'global'},
vi_def=true,
varname='p_pw',
defaults={if_true={vi=0}}
},
{
full_name='pumblend', abbreviation='pb',
type='number', scope={'global'},
vi_def=true,
redraw={'ui_option'},
varname='p_pb',
defaults={if_true={vi=0}}
defaults={if_true={vi=15}}
},
{
full_name='pyxversion', abbreviation='pyx',

View File

@ -82,13 +82,6 @@ static void pum_compute_size(void)
}
}
// Return the minimum width of the popup menu.
static int pum_get_width(void)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return p_pw == 0 ? PUM_DEF_WIDTH : (int)p_pw;
}
/// Show the popup menu with items "array[size]".
/// "array" must remain valid until pum_undisplay() is called!
/// When possible the leftmost character is aligned with screen column "col".
@ -104,7 +97,6 @@ static int pum_get_width(void)
void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
int cmd_startcol)
{
int def_width;
int context_lines;
int above_row;
int below_row;
@ -168,7 +160,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
}
}
def_width = pum_get_width();
int def_width = (int)p_pw;
win_T *pvwin = NULL;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
@ -284,9 +276,9 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
def_width = max_width;
}
if ((((col < Columns - pum_get_width()) || (col < Columns - max_width))
if ((((col < Columns - p_pw) || (col < Columns - max_width))
&& !curwin->w_p_rl)
|| (curwin->w_p_rl && ((col > pum_get_width()) || (col > max_width)))) {
|| (curwin->w_p_rl && ((col > p_pw) || (col > max_width)))) {
// align pum column with "col"
pum_col = col;
@ -300,18 +292,18 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
}
if ((pum_width > max_width + pum_kind_width + pum_extra_width + 1)
&& (pum_width > pum_get_width())) {
&& (pum_width > p_pw)) {
// the width is too much, make it narrower
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
if (pum_width < pum_get_width()) {
pum_width = pum_get_width();
if (pum_width < p_pw) {
pum_width = (int)p_pw;
}
}
} else if (((col > pum_get_width() || col > max_width)
} else if (((col > p_pw || col > max_width)
&& !curwin->w_p_rl)
|| (curwin->w_p_rl
&& (col < Columns - pum_get_width()
&& (col < Columns - p_pw
|| col < Columns - max_width))) {
// align right pum edge with "col"
if (curwin->w_p_rl) {
@ -332,8 +324,8 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
pum_width = pum_col - pum_scrollbar;
}
if (pum_width < pum_get_width()) {
pum_width = pum_get_width();
if (pum_width < p_pw) {
pum_width = (int)p_pw;
if (curwin->w_p_rl) {
if (pum_width > pum_col) {
pum_width = pum_col;
@ -344,10 +336,10 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
}
}
} else if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
&& pum_width > pum_get_width()) {
&& pum_width > p_pw) {
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
if (pum_width < pum_get_width()) {
pum_width = pum_get_width();
if (pum_width < p_pw) {
pum_width = (int)p_pw;
}
}
} else if (Columns < def_width) {
@ -361,9 +353,9 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
assert(Columns - 1 >= INT_MIN);
pum_width = (int)(Columns - 1);
} else {
if (max_width > pum_get_width()) {
if (max_width > p_pw) {
// truncate
max_width = pum_get_width();
max_width = (int)p_pw;
}
if (curwin->w_p_rl) {