fish gets stuck in history search mode if you press cmd+up-arrow
injust opened this issue · comments
Using:
fish, version 3.7.1
macOS Sonoma 14.5
Ghostty terminal
When you press cmd+up-arrow, fish triggers history search mode as if you pressed up-arrow. But after you press down-arrow to exit history search mode, commandline --search-mode
is still true for the current prompt.
I was unable to reproduce this in Terminal.app, kitty, or WezTerm. Might be because some terminals handle the cmd+up-arrow input themselves instead of sending it to the shell (e.g. Terminal.app uses it as a shortcut to jump to a mark).
I tested with the following config.fish
:
# Modified from _atuin_bind_up at https://github.com/atuinsh/atuin/blob/95cc472037fcb3207b510e67f1a44af4e2a2cae9/crates/atuin/src/shell/atuin.fish#L55
function _bind_up
# Fallback to fish's builtin up-or-search if we're in search or paging mode
if commandline --search-mode
echo search-mode
else if commandline --paging-mode
echo paging-mode
else
echo up-arrow
end
end
if status is-interactive
# How atuin binds the up-arrow, from `atuin init fish`
bind -k up _bind_up
bind \eOA _bind_up
bind \e\[A _bind_up
if bind -M insert > /dev/null 2>&1
bind -M insert -k up _bind_up
bind -M insert \eOA _bind_up
bind -M insert \e\[A _bind_up
end
end
Screen.Recording.2024-06-22.at.7.05.47.PM.mov
Just as an fyi: not too many of us have access to a (modern) macOS desktop for testing issues that arise with specific combinations of third party apps, so this might sit for a while if there's no repro on Linux.
I don't have a Linux system to repro on, unfortunately.
I should mention that Ghostty is in closed beta right now. I don't think this is a Ghostty issue, but I wasn't able to repro on a few other terminals I tried. If you need to test on Ghostty, I can ask to get you access.
Can you try using Up and Cmd+Up in fish_key_reader
to see what the difference is?
up
: bind \e\[A 'do something'
cmd+up
: bind \e\[1\;9A 'do something'