-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FZF appears to swallow key presses when used with less
on Git Bash with ZSH on Windows
#4260
Comments
The issue was first noticed in |
@junegunn I'm not overly familiar with debugging shell code, but I'm willing to help debug this if you have any ideas of what could be going on. |
I have no idea. One thing I'd like to check is if fzf is using Lines 14 to 44 in 3ba82b6
|
For both Git bash with ZSH and vanilla Git bash:
|
I started a Windows Server 2025 instance on EC2, installed the latest Git bash, downloaded fzf 0.60.2, and tested it. So here's what I've found. seq 1000 > test
# less opens and closes immediately
echo test | ./fzf --bind 'enter:execute:less {}'
# But with the redirection, less works
# * NOTE: On non-Windows systems, this is not required
# https://github.com/junegunn/fzf/commit/3dee8778d073199e0fe1e186e54f7eabc2fdef43
echo test | ./fzf --bind 'enter:execute:less {} > /dev/tty'
# However, when using a non-fullscreen renderer, less becomes unresponsive as reported
echo test | ./fzf --bind 'enter:execute:less {} > /dev/tty' --height 50% So the issue has to do with the LightRenderer implementation for Windows. https://github.com/junegunn/fzf/blob/master/src/tui/light_windows.go |
This seems to be the culprit. Lines 70 to 84 in 21ce700
|
Can you test 8916cbc? Attaching the amd64 binary. fzf.exe.zip It still has a problem of consuming a key for |
This pretty much solves it. The first key press is still being swallowed, but subsequent key presses work as expected. With the repro I gave for this issue, if I want to exit less I need to press |
Thanks for the confirmation. I'll release a new patch version with the (partial) fix and keep this open until we find the perfect solution. Some pointers: |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [junegunn/fzf](https://github.com/junegunn/fzf) | patch | `v0.60.2` -> `v0.60.3` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>junegunn/fzf (junegunn/fzf)</summary> ### [`v0.60.3`](https://github.com/junegunn/fzf/releases/tag/v0.60.3): 0.60.3 [Compare Source](junegunn/fzf@v0.60.2...v0.60.3) - Bug fixes and improvements - \[fish] Enable multiple history commands insertion ([#​4280](junegunn/fzf#4280)) ([@​bitraid](https://github.com/bitraid)) - \[walker] Append '/' to directory entries on MSYS2 ([#​4281](junegunn/fzf#4281)) - Trim trailing whitespaces after processing ANSI sequences ([#​4282](junegunn/fzf#4282)) - Remove temp files before `become` when using `--tmux` option ([#​4283](junegunn/fzf#4283)) - Fix condition for using item numlines cache ([#​4285](junegunn/fzf#4285)) ([@​alex-huff](https://github.com/alex-huff)) - Make `--accept-nth` compatible with `--select-1` ([#​4287](junegunn/fzf#4287)) - Increase the query length limit from 300 to 1000 ([#​4292](junegunn/fzf#4292)) - \[windows] Prevent fzf from consuming user input while paused ([#​4260](junegunn/fzf#4260)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Checklist
man fzf
)Output of
fzf --version
0.60.0 (3347d61)
OS
Shell
Problem / Steps to reproduce
Steps
echo "<file>" | fzf --bind="enter:execute(less {})"
where<file>
is any regular file.fzf
prompt appears with the given file. Press enter to select it.less
prompt opens. Now try to press any key (j, k, etc) and see that nothing happens. Pressing Esc,<C-d>
,<C-x>
or<C-c>
also have no effect. The only way to return to ZSH is to manually kill theless
process.Notes
less
process is killed, the pressed keys will appear infzf
's prompt, which seems to indicate thatfzf
is somehow swallowing the key presses that should've gone toless
. In the example below, I pressedkl
before killing theless
process. See that the pressed keys appear infzf
's prompt.The text was updated successfully, but these errors were encountered: