atuinsh / atuin

✨ Magical shell history
https://atuin.sh
MIT License
20.22k stars 549 forks source link

[Bug]: Scrolling in tmux window invokes Atuin history panel #2338

Open lemorage opened 1 month ago

lemorage commented 1 month ago

What did you expect to happen?

I expected to be able to scroll within a tmux window without triggering the Atuin history panel. The Atuin history search should not be invoked when scrolling.

What happened?

When I scroll within a tmux window, the Atuin history panel is automatically invoked. As a result, I can't even see the previous command output by scrolling up. I wonder if there is a walkaround for that?

atuin in a tmux window
I was scrolling my mouse in a tmux window

Atuin doctor output

{
  "atuin": {
    "version": "18.3.0",
    "sync": {
      "cloud": true,
      "records": false,
      "auto_sync": true,
      "last_sync": "2024-08-02 13:16:28.349833 +00:00:00"
    },
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Darwin",
    "arch": "arm64",
    "version": "14.5",
    "disks": [
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      },
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      }
    ]
  }
}

Code of Conduct

mattiafelice-palermo commented 1 week ago

I am also experiencing this If any additional info is needed, I can provide more details.

yamafaktory commented 4 days ago

I'm facing the exact same issue here with Zellij. In my case, I'm within nvim using telescope and scrolling through the results, then the search history kicks in and ultimately nvim crashes (`SIGSEGV (Address boundary error) and I end up back in the terminal.

yamafaktory commented 4 days ago

What I see in the source is that atuin polls the mouse events via crossterm here: https://github.com/atuinsh/atuin/blob/6e15286f0c94b89d4c5f9b8fa1e9a72cd209017c/crates/atuin/src/command/client/search/interactive.rs#L117

yamafaktory commented 4 days ago

I was too swift to comment... After disabling Atuin and using only my terminal (alacritty - without Zellij), this is still crashing so it's a Neovim issue.

mattiafelice-palermo commented 21 hours ago

Good catch. I have noticed that this issue appears only when using tmux. When connecting directly from the windows terminal to my remote ubuntu machine, the scrolling wheel behaves normally. Hopefully someone will figure out where the compatibility issue stem from.

mattiafelice-palermo commented 20 hours ago

For anyone interested, in my case running tmux set-option -g mouse on directly in the shell solved the issue...

For some reason, putting it in .tmux.conf didn't work, but running the command above directly in the terminal made it work and stick through different new sessions.