patch 9.1.1150: :hi completion may complete to wrong value
Problem: :highlight auto-complettion has a minor bug where an existing
highlight group with a cterm color being unset would result in
it being auto-completed to -1 in cmdline which is invalid.
Solution: Correctly check for whether an int value is set to non-zero
before retrieving the existing value for auto-complete. Also
do this for attr/string values as they previously worked only
by accident (Yee Cheng Chin).
closes: #16726
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
aa8345a968
commit
9b41e8f766
@ -4531,14 +4531,17 @@ expand_highlight_group(
|
||||
|
||||
char_u buf[MAX_ATTR_LEN];
|
||||
|
||||
if (expand_hi_synid != 0 && type != 0 && expand_hi_include_orig)
|
||||
expand_hi_curvalue = NULL;
|
||||
if (expand_hi_include_orig)
|
||||
{
|
||||
// Retrieve the current value to go first in completion
|
||||
expand_hi_curvalue = highlight_arg_to_string(
|
||||
type, iarg, sarg, buf);
|
||||
if (((type == LIST_ATTR || type == LIST_INT) && iarg != 0) ||
|
||||
(type == LIST_STRING && sarg != NULL))
|
||||
{
|
||||
// Retrieve the current value to go first in completion
|
||||
expand_hi_curvalue = highlight_arg_to_string(
|
||||
type, iarg, sarg, buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
expand_hi_curvalue = NULL;
|
||||
|
||||
if (expandfunc != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user