Skip to content
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

Windows: Mouse-clicking doesn't work properly in bash #3847

Open
5 of 10 tasks
ykhan21 opened this issue Jun 10, 2024 · 1 comment
Open
5 of 10 tasks

Windows: Mouse-clicking doesn't work properly in bash #3847

ykhan21 opened this issue Jun 10, 2024 · 1 comment

Comments

@ykhan21
Copy link

ykhan21 commented Jun 10, 2024

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • 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
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

  1. scoop install git fzf
  2. In Git Bash, run ls | fzf
  3. 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.

@junegunn
Copy link
Owner

There are two renderer implementations for Windows.

  1. FullscreenRenderer. Based on tcell library. We use this in fullscreen mode.
  2. LightRenderer. It was added later to support --height and used only when --height option is given.

FullscreenRenderer

LightRenderer

  • Mouse works on cmd.exe
  • Mouse works on mintty, but click position is broken. Fixed in 0684a20

So with 0684a20, 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.

fzf.exe.zip

junegunn added a commit that referenced this issue Jul 25, 2024
This reverts commit dca2262.

> For mouse support on mintty
> Fix #3847

The current implementation LightRenderer for Windows is unable to accept
non-ASCII input unlike the tcell renderer. So even though it supports
mouse on mintty, we shouldn't use it as the default.

* #3799
* #3847
@junegunn junegunn reopened this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants