diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-11-13 10:53:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-13 10:53:59 +0100 |
commit | 0a96f18ed774ebc27db50eba4d8a4437e970a331 (patch) | |
tree | 14b4ab7c3807ef91147e7de381008b4c01594c9b /src | |
parent | c4f84fc2e294f6dd992f4abad49566d097ff7169 (diff) | |
parent | d7e7578ada343eab090643eb698bd146d5bbfd27 (diff) | |
download | rneovim-0a96f18ed774ebc27db50eba4d8a4437e970a331.tar.gz rneovim-0a96f18ed774ebc27db50eba4d8a4437e970a331.tar.bz2 rneovim-0a96f18ed774ebc27db50eba4d8a4437e970a331.zip |
Merge pull request #21033 from bfredl/winfix
fix(ui): fix some cases of stale highlight definitions
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/decoration_provider.c | 19 | ||||
-rw-r--r-- | src/nvim/highlight_group.c | 2 |
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. |