Skip to content

Horizontal mouse wheel events treated as vertical scrolling #4848

Closed

Description

@jason5122

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.73.1 (Homebrew)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

Note

No AI was used! I noticed you closed contributions due to an influx of low-effort PRs, so I put in the time to keep the code minimal and fully understand the changes. I love your work, please keep going!

One day, I encountered jittering when scrolling up/down on my macOS trackpad in fzf. I realized it was because the horizontal scroll component is factored in, so if you scroll 45° up and right or 45° down and left, the scroll counteracts itself! I propose that horizontal mouse wheel events should not count as vertical scrolling.

Reproducing

  1. Use a terminal that supports horizontal scrolling (e.g., Ghostty, Alacritty, Kitty, etc.).
  2. Scroll horizontally in fzf.
  3. Scrolling left should scroll upwards. Scrolling right should scroll downwards.

The Fix

I believe the issue has to do with lines 908-915 of light.go. The logic for SGR mouse wheel events is as follows. Is this intended?

SGR Mouse Event Formula Scroll
64 (up) 64 & 1 => 0 +1 (up)
65 (down) 65 & 1 => 1 -1 (down)
66 (left) 66 & 1 => 0 +1 (up)
67 (right) 67 & 1 => 1 -1 (down)

I made a branch with the following changes:

SGR Mouse Event Formula Scroll
64 64 & 3 => 0 +1
65 65 & 3 => 1 -1
66 66 & 3 => 2 0 (ignored)
67 67 & 3 => 3 0 (ignored)

I just made horizontal scrolling a no-op. In the future, we can support proper horizontal scrolling (#4824).

Activity

  1. junegunn commented on Jun 28, 2026

    @junegunn
    Owner

    Thanks, to be clear, I'm not against AI. It's a great tool if you know what you're doing. I was just tired of automated, low-effort PRs that weren't backed by any hands-on experience and provided no real benefit to (sentient) users.

    Anyway, that behavior was not intended. I think I didn't think about the horizontal scrolling when I wrote the code. I'll cherry-pick your commits. Thanks!

  2. added
    bug
    on Jun 28, 2026
  3. added a commit that references this issue on Jun 28, 2026
    9e4f8e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions