Fix: load completions when zcompdump is missing - #86
Merged
Merged
Conversation
The compinit cache check used `[[ -n ${dump}(#qN.mh+24) ]]`. With
EXTENDED_GLOB set the qualifier does match, so fresh and stale dumps were
routed correctly, but a *missing* dump also produced an empty match and
fell to the `compinit -C` branch. `-C` skips the dump rebuild entirely, so
a first run on a new machine, or any run after the dump was deleted, came
up with no completions loaded and stayed that way until the file happened
to reappear.
Match through an array and invert the condition so the fast path is taken
only on a positive match:
fresh (<24h) -> compinit -C
stale (>24h) -> compinit + touch
missing -> compinit + touch
Also pass -d explicitly so both branches agree on the dump path, and save
and restore EXTENDED_GLOB instead of unconditionally unsetting an option
the user's own config may have enabled.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017opPVGYfryqcV8BAt66zqW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The compinit cache check used
[[ -n ${dump}(#qN.mh+24) ]]. With EXTENDED_GLOB set the qualifier does match, so fresh and stale dumps were routed correctly, but a missing dump also produced an empty match and fell to thecompinit -Cbranch.-Cskips the dump rebuild entirely, so a first run on a new machine, or any run after the dump was deleted, came up with no completions loaded and stayed that way until the file happened to reappear.Match through an array and invert the condition so the fast path is taken only on a positive match:
fresh (<24h) -> compinit -C
stale (>24h) -> compinit + touch
missing -> compinit + touch
Also pass -d explicitly so both branches agree on the dump path, and save and restore EXTENDED_GLOB instead of unconditionally unsetting an option the user's own config may have enabled.