fix: pass fish_key_bindings to prompt subshell#653
Closed
mzilinski wants to merge 1 commit intoIlanCosman:mainfrom
Closed
fix: pass fish_key_bindings to prompt subshell#653mzilinski wants to merge 1 commit intoIlanCosman:mainfrom
mzilinski wants to merge 1 commit intoIlanCosman:mainfrom
Conversation
The async prompt subshell receives fish_bind_mode but not fish_key_bindings. When fish_key_bindings is set globally (not universally) in the parent shell, it is unset inside the subshell, causing _tide_item_character to fall through to the vi-mode branch and render tide_character_vi_icon_default instead of tide_character_icon — even though the user is on default key bindings. Pass fish_key_bindings alongside fish_bind_mode so the subshell matches the parent's key-binding state.
Author
|
Closing as duplicate of #619, which makes the same fish_prompt.fish change plus an additional safety check in _tide_item_character.fish. I missed that PR before opening this one. See my comment on #619 for an additional reproduction case (globally-scoped fish_key_bindings from a distro config, independent of fish 4.3). |
4 tasks
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.
Summary
The async prompt subshell in
fish_prompt.fishreceivesfish_bind_modebut notfish_key_bindings. Whenfish_key_bindingsis set globally (not universally) in the parent shell — which is the case on distros like CachyOS that set it viaconfig.fish— the variable is unset inside the subshell.As a result,
_tide_item_characterfalls through its first branch:The empty
$fish_key_bindingsin the subshell fails the equality test, the switch runs,$fish_bind_modeisdefault, and Tide renderstide_character_vi_icon_default(❮) instead oftide_character_icon(❯) — even though the user is on default (emacs) key bindings._tide_item_vi_modehas the same check and is affected analogously.Fix
Pass
fish_key_bindingsalongsidefish_bind_modeinto the subshell's env prefix, in all fourfish_promptvariants (1-line/2-line × transient/non-transient). One-line change each.Reproduction
config.fish(not as a universal variable):set -g fish_key_bindings fish_default_key_bindingscharacteritem╰─❮instead of╰─❯Verifying the character function in isolation (
_tide_item_charactercalled directly in the interactive shell) prints❯correctly, confirming the subshell is where the variable gets lost.Test plan
exec fishconfirms prompt now shows❯set -U fish_key_bindings ...