fzf
fzf copied to clipboard
Windows: Mouse-clicking doesn't work properly in bash
Checklist
- [X] I have read through the manual page (
man fzf) - [X] I have searched through the existing issues
- [X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.53.0 (c4a9ccd)
OS
- [ ] Linux
- [ ] macOS
- [X] Windows
- [ ] Etc.
Shell
- [X] bash
- [ ] zsh
- [ ] fish
Problem / Steps to reproduce
-
scoop install git fzf - In Git Bash, run
ls | fzf - Click on any item on the list. Observe that the item that becomes selected is not what was clicked.
Also, on Wezterm with bash, clicking does not seem to work at all, while on Wezterm with cmd, clicking works.
There are two renderer implementations for Windows.
- FullscreenRenderer. Based on tcell library. We use this in fullscreen mode.
- LightRenderer. It was added later to support
--heightand used only when--heightoption is given.
FullscreenRenderer
- Mouse works on cmd.exe
- Mouse doesn't work on mintty
- Seems to be a limitation of tcell. https://github.com/gdamore/tcell/issues/133#issuecomment-766434124
LightRenderer
- Mouse works on cmd.exe
- Mouse works on mintty, but click position is broken. Fixed in 0684a20ea3da6100cf43c919d1fcfda3644eb8c1
So with 0684a20ea3da6100cf43c919d1fcfda3644eb8c1, mouse works properly when --height is used on mintty, but not in fullscreen mode. We can fix this by always using LightRenderer.
diff --git a/src/terminal.go b/src/terminal.go
index 128da4e..7307c17 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -711,7 +711,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
}
}
if fullscreen {
- if tui.HasFullscreenRenderer() {
+ if !tui.IsLightRendererSupported() {
renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse)
} else {
renderer, err = tui.NewLightRenderer(ttyin, opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit,
It's a simple change, and I can confirm that it fixes the mouse problem. However, I'm not sure if there are any unwanted side effects. I could use some help testing the binary.