From 8a17a5d1c0537b71a8ad195c1719c1562535bad7 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Sat, 12 Sep 2020 09:16:51 +0200 Subject: [PATCH] Perf: add a comment on cache invalidation --- highlighters/main/main-highlighter.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index edabcc9..666a341 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -1767,6 +1767,10 @@ _zsh_highlight_main__precmd_hook() { unsetopt warnnestedvar fi + # NOTE: Caches are invalidated (cleared) only in the precmd hook. This means that + # highlighting may not reflect state changes after the last precmd hook. For example, + # if a zle widget or another process deletes /bin/ls while ls is highlighted as a + # command, it'll keep being highlighted that way until the precmd hook is executed. _zsh_highlight_main__command_type_cache=() _zsh_highlight_main__path_cache=() _zsh_highlight_main__arg_cache=()