patch 9.2.0352: 'winhighlight' of left window blends into right window

Problem: 'winhighlight' of left window blends into right window
Solution: Allow to push a NULL highlight override (Foxe Chen)

closes: #19980

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2026-04-15 16:52:09 +00:00
committed by Christian Brabandt
parent bfa46a52f6
commit 2252d2c1e5
5 changed files with 58 additions and 5 deletions
+8 -5
View File
@@ -184,7 +184,8 @@ typedef struct
typedef struct hl_overrides_S hl_overrides_T;
struct hl_overrides_S
{
hl_override_T *arr; // May be NULL if "arr" was freed
hl_override_T *arr; // May be NULL if "arr" was freed or no highlight
// overrides (all values set to default)
int len;
hl_overrides_T *next; // Used to handle recursive calls
@@ -5804,9 +5805,10 @@ set_highlight_attr(hl_override_T *arr, int len, bool update_ids)
bool
push_highlight_overrides(hl_override_T *arr, int len)
{
// Don't want to do anything if "arr" is NULL or if "arr" is already the
// current override.
if (arr == NULL || (overrides != NULL && overrides->arr == arr))
// Don't want to do anything if "arr" is already the current override. If
// "arr" is NULL (but overrides->arr is not), then still push an override,
// but "->arr" will just be NULL so any previous overrides are cleared.
if (overrides != NULL && overrides->arr == arr)
return false;
hl_overrides_T *set;
@@ -5831,7 +5833,8 @@ push_highlight_overrides(hl_override_T *arr, int len)
memcpy(highlight_attr, highlight_attr_raw, sizeof(highlight_attr));
// Update highlight_attr[] array
set_highlight_attr(arr, len, false);
if (arr != NULL)
set_highlight_attr(arr, len, false);
return true;
}
+12
View File
@@ -0,0 +1,12 @@
> +0&#ffffff0@36||+1&&| +0&&@36
|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|[+0#ffffff16#e000002|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1| |[+1#0000000#ffffff0|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1
| +0&&@74
+12
View File
@@ -0,0 +1,12 @@
| +0&#ffffff0@36||+1&&> +0&&@36
|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|~| @35||+1#0000000&|~+0#4040ff13&| @35
|[+1#0000000&|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1| +3&&|[|N|o| |N|a|m|e|]| @9|0|,|0|-|1| @9|A|l@1
| +0&&@74
+24
View File
@@ -1788,4 +1788,28 @@ func Test_VertSplitNC_fillchars()
call StopVimInTerminal(buf)
endfunc
" Test that 'winhighlight' of window left of separator does not apply when
" drawing the window to the right of the separator.
func Test_VertSplitNC_winhighlight()
CheckScreendump
let lines =<< trim END
vsplit
set winhighlight=StatusLine:ErrorMsg
END
call writefile(lines, 'Xtest_vertsplitNC_winhighlight', 'D')
let buf = RunVimInTerminal('-S Xtest_vertsplitNC_winhighlight', {'rows': 12})
call TermWait(buf)
call VerifyScreenDump(buf, 'Test_VertSplitNC_whl1', {})
call term_sendkeys(buf, "\<C-w>\<C-l>") " Go to window with empty winhighlight
call TermWait(buf)
call VerifyScreenDump(buf, 'Test_VertSplitNC_whl2', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
352,
/**/
351,
/**/