mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-19 14:51:13 -03:00
As reported in https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$CLuoHTdvcRj_8-HBBq0p-lmGWeix5khEtKEDxN2Ulfo Running fish -C ' fzf_key_bindings echo fish_vi_key_bindings >>~/.config/fish/config.fish fzf-history-widget ' and pressing "enter" will add escape sequences like "[2 q" (cursor shape) to fish's command line. This is because fzf-history-widget binds "enter" to a filter that happens to be a fish script: set -lx FZF_DEFAULT_OPTS \ ... \ "--bind='enter:become:string replace -a -- \n\t \n {2..} | string collect'" \ '--with-shell='(status fish-path)\\ -c) The above ~/.config/fish/config.fish (redundantly) runs "fish_vi_key_bindings" even in *noninteractive* shells, then "fish_vi_cursor" will print cursor sequences in its "fish_exit" handler. The sequence is not printed to the terminal but to fzf which doesn't parse CSI commands. This is a regression introduced bya5dfa84f73(fish_vi_cursor: skip if stdin is not a tty, 2023-11-14). That commit wanted "fish -c read" to be able to use Vi cursor. This is a noninteractive shell, but inside "read" we are "effectively interactive". However "status is-interactive" does not tell us that. Let's use a more contained fix to make sure that we print escape sequences only if either fish is interactive, or if we are evaluating an interactive read. In general, "fish -c read" is prone to configuration errors, since we recommend gating configuration (for bind etc) on "status is-interactive" which will not run here. (cherry picked from commit495083249b)