aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-22 06:52:32 +0800
committerGitHub <noreply@github.com>2024-11-22 06:52:32 +0800
commitff75f345ab5fa57c6560db021e8eb099aff90472 (patch)
tree231593b41f0e203427f6f76f1776e399719b90cc /src
parent92a83f671b227ace7ded5006619bb943c2d9ecc0 (diff)
downloadrneovim-ff75f345ab5fa57c6560db021e8eb099aff90472.tar.gz
rneovim-ff75f345ab5fa57c6560db021e8eb099aff90472.tar.bz2
rneovim-ff75f345ab5fa57c6560db021e8eb099aff90472.zip
fix(highlight): 'winhl' shouldn't take priority over API (#31288)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/window.c1
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/option.c8
3 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 5a4972ef23..ee7729ce81 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -476,6 +476,7 @@ void nvim_win_set_hl_ns(Window window, Integer ns_id, Error *err)
}
win->w_ns_hl = (NS)ns_id;
+ win->w_ns_hl_winhl = -1;
win->w_hl_needs_update = true;
redraw_later(win, UPD_NOT_VALID);
}
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index d33734ccfe..a8f3fc45b9 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -1035,7 +1035,7 @@ struct window_S {
synblock_T *w_s; ///< for :ownsyntax
int w_ns_hl;
- int w_ns_hl_winhl;
+ int w_ns_hl_winhl; ///< when set to -1, 'winhighlight' shouldn't be used
int w_ns_hl_active;
int *w_ns_hl_attr;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 1cfe4cd08b..d3cbe9f056 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1736,8 +1736,14 @@ bool parse_winhl_opt(const char *winhl, win_T *wp)
p = wp->w_p_winhl;
}
+ if (wp != NULL && wp->w_ns_hl_winhl < 0) {
+ // 'winhighlight' shouldn't be used for this window.
+ // Only check that the value is valid.
+ wp = NULL;
+ }
+
if (!*p) {
- if (wp != NULL && wp->w_ns_hl_winhl && wp->w_ns_hl == wp->w_ns_hl_winhl) {
+ if (wp != NULL && wp->w_ns_hl_winhl > 0 && wp->w_ns_hl == wp->w_ns_hl_winhl) {
wp->w_ns_hl = 0;
wp->w_hl_needs_update = true;
}