aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-11-12 16:41:36 +0100
committerbfredl <bjorn.linse@gmail.com>2022-11-13 10:20:28 +0100
commitd7e7578ada343eab090643eb698bd146d5bbfd27 (patch)
tree4fd3279f8a9f4aae4809f405f3a120ecfc3230a3 /src
parent7335a67b5754255f0e892303a0f4e3521035e7d8 (diff)
downloadrneovim-d7e7578ada343eab090643eb698bd146d5bbfd27.tar.gz
rneovim-d7e7578ada343eab090643eb698bd146d5bbfd27.tar.bz2
rneovim-d7e7578ada343eab090643eb698bd146d5bbfd27.zip
fix(ui): fix some cases of stale highlight definitions
fixes #20695
Diffstat (limited to 'src')
-rw-r--r--src/nvim/decoration_provider.c19
-rw-r--r--src/nvim/highlight_group.c2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c
index 48664421a3..f356efffdc 100644
--- a/src/nvim/decoration_provider.c
+++ b/src/nvim/decoration_provider.c
@@ -194,6 +194,25 @@ void decor_providers_invoke_end(DecorProviders *providers, char **err)
}
}
+/// Mark all cached state of per-namespace highlights as invalid. Revalidate
+/// current namespace.
+///
+/// Expensive! Should on be called by an already throttled validity check
+/// like highlight_changed() (throttled to the next redraw or mode change)
+void decor_provider_invalidate_hl(void)
+{
+ size_t len = kv_size(decor_providers);
+ for (size_t i = 0; i < len; i++) {
+ DecorProvider *item = &kv_A(decor_providers, i);
+ item->hl_cached = false;
+ }
+
+ if (ns_hl_active) {
+ ns_hl_active = -1;
+ hl_check_ns();
+ }
+}
+
DecorProvider *get_decor_provider(NS ns_id, bool force)
{
assert(ns_id > 0);
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 3c3c834c6c..65e3073303 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -2073,6 +2073,8 @@ void highlight_changed(void)
}
}
highlight_ga.ga_len = hlcnt;
+
+ decor_provider_invalidate_hl();
}
/// Handle command line completion for :highlight command.