fix(init): eliminate a potential recursive definition #6398
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.
Description
This PR will eliminate a potential recursive definition. It will benefit users who want to use vi mode in zsh.
Motivation and Context
Closes #3418
Closes #5522
Current
src/init/starship.zsh
has a potential risk to cause recursive definition ofstarship_zle-keymap-select-wrapped
when user set vi mode.for example:
use this minimal zshrc:
then start a terminal, type
source ~/.zshrc
twicepress ESC to trigger vi normal mode, error message show bellow:
check
starship_zle-keymap-select-wrapped
and__starship_preserved_zle_keymap_select
see a recursive definition
How Has This Been Tested?
I use this minimal zshrc:
~/github-project/starship/target/debug/starship
is the binary which I build.repeat the operations, vi mode works well and no error is reported.
and user defined action works as well:
Checklist: