mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
fix(float): apply 'winblend' to title/footer highlight (#25999)
This commit is contained in:
@@ -725,6 +725,7 @@ static void win_redr_bordertext(win_T *wp, VirtText vt, int col)
|
||||
if (text == NULL) {
|
||||
break;
|
||||
}
|
||||
attr = hl_apply_winblend(wp, attr);
|
||||
col += grid_line_puts(col, text, -1, attr);
|
||||
}
|
||||
}
|
||||
|
@@ -323,6 +323,23 @@ int hl_get_ui_attr(int ns_id, int idx, int final_id, bool optional)
|
||||
.id1 = idx, .id2 = final_id });
|
||||
}
|
||||
|
||||
/// Apply 'winblend' to highlight attributes.
|
||||
///
|
||||
/// @param wp The window to get 'winblend' value from.
|
||||
/// @param attr The original attribute code.
|
||||
///
|
||||
/// @return The attribute code with 'winblend' applied.
|
||||
int hl_apply_winblend(win_T *wp, int attr)
|
||||
{
|
||||
HlEntry entry = attr_entry(attr);
|
||||
// if blend= attribute is not set, 'winblend' value overrides it.
|
||||
if (entry.attr.hl_blend == -1 && wp->w_p_winbl > 0) {
|
||||
entry.attr.hl_blend = (int)wp->w_p_winbl;
|
||||
attr = get_attr_entry(entry);
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
void update_window_hl(win_T *wp, bool invalid)
|
||||
{
|
||||
int ns_id = wp->w_ns_hl;
|
||||
@@ -358,13 +375,8 @@ void update_window_hl(win_T *wp, bool invalid)
|
||||
wp->w_hl_attr_normal = float_win ? HL_ATTR(HLF_NFLOAT) : 0;
|
||||
}
|
||||
|
||||
// if blend= attribute is not set, 'winblend' value overrides it.
|
||||
if (wp->w_floating && wp->w_p_winbl > 0) {
|
||||
HlEntry entry = attr_entry(wp->w_hl_attr_normal);
|
||||
if (entry.attr.hl_blend == -1) {
|
||||
entry.attr.hl_blend = (int)wp->w_p_winbl;
|
||||
wp->w_hl_attr_normal = get_attr_entry(entry);
|
||||
}
|
||||
if (wp->w_floating) {
|
||||
wp->w_hl_attr_normal = hl_apply_winblend(wp, wp->w_hl_attr_normal);
|
||||
}
|
||||
|
||||
wp->w_float_config.shadow = false;
|
||||
@@ -375,13 +387,8 @@ void update_window_hl(win_T *wp, bool invalid)
|
||||
attr = hl_get_ui_attr(ns_id, HLF_BORDER,
|
||||
wp->w_float_config.border_hl_ids[i], false);
|
||||
}
|
||||
HlAttrs a = syn_attr2entry(attr);
|
||||
if (a.hl_blend == -1 && wp->w_p_winbl > 0) {
|
||||
HlEntry entry = attr_entry(attr);
|
||||
a.hl_blend = entry.attr.hl_blend = (int)wp->w_p_winbl;
|
||||
attr = get_attr_entry(entry);
|
||||
}
|
||||
if (a.hl_blend > 0) {
|
||||
attr = hl_apply_winblend(wp, attr);
|
||||
if (syn_attr2entry(attr).hl_blend > 0) {
|
||||
wp->w_float_config.shadow = true;
|
||||
}
|
||||
wp->w_float_config.border_attr[i] = attr;
|
||||
@@ -400,13 +407,8 @@ void update_window_hl(win_T *wp, bool invalid)
|
||||
wp->w_hl_attr_normalnc = hl_def[HLF_INACTIVE];
|
||||
}
|
||||
|
||||
// if blend= attribute is not set, 'winblend' value overrides it.
|
||||
if (wp->w_floating && wp->w_p_winbl > 0) {
|
||||
HlEntry entry = attr_entry(wp->w_hl_attr_normalnc);
|
||||
if (entry.attr.hl_blend == -1) {
|
||||
entry.attr.hl_blend = (int)wp->w_p_winbl;
|
||||
wp->w_hl_attr_normalnc = get_attr_entry(entry);
|
||||
}
|
||||
if (wp->w_floating) {
|
||||
wp->w_hl_attr_normalnc = hl_apply_winblend(wp, wp->w_hl_attr_normalnc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user