kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.11k stars 972 forks source link

Mousewheel scroll stopped working after recent update #7807

Closed LittleHendrix closed 1 month ago

LittleHendrix commented 1 month ago

*Describe the bug

I have had issue with this when I first installed Kitty a while back. After search on the internet I stumbled across a post where someone suggested adding set -as terminal-overrides 'screen*:kmous=\E[M' to ~/.tmux.conf. And after I had added that line, the mouse wheel started working, and continue to work for about a year. However, it has stopped working recently after I ran a brew update & upgrade. I ran another brew update and there was a new update available, I then upgraded to that version. But the mouse wheel still isn't working after the upgrade.

I thought it may have something to do with the tmux.conf or even the neovim config. However, I tried loading neovim (in tmux session) in iTerm and the default MacOS terminal, and the mouse wheel worked in both. I was able to scroll through the neovim buffer both inside tmux and directly in those terminal emulators. I then though maybe it was my kitty config, so I tried running it in kitty --config NONE, still no luck.

To Reproduce Steps to reproduce the behavior:

  1. start neovim inside a tmux session, mouse wheel not working even with set -g mouse on
  2. start neovim inside a tmux session in kitty --config NONE, mouse wheel not working
  3. start neovim directly in kitty, mouse wheel not working
  4. start neovim directly in kitty --config NONE, mouse wheel not working

Screenshots If applicable, add screenshots to help explain your problem.

Environment details

kitty 0.36.1 (95245ee473) created by Kovid Goyal
Darwin chen.lu@tray.io 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul  5 17:54:20 PDT 2024; root:xnu-10063.141.1~2/RELEASE_X86_64 x86_64
ProductName:        macOS ProductVersion:       14.6 BuildVersion:      23G80
OpenGL: '4.1 ATI-5.5.17' Detected version: 4.1
Frozen: True
Fonts:
  medium: UbuntuMonoNF: /Users/chen/Library/Fonts/UbuntuMonoNerdFont-Regular.ttf
  bold: UbuntuMonoNF-Bold: /Users/chen/Library/Fonts/UbuntuMonoNerdFont-Bold.ttf
  italic: UbuntuMonoNF-Italic: /Users/chen/Library/Fonts/UbuntuMonoNerdFont-Italic.ttf
  bi: UbuntuMonoNF-BoldItalic: /Users/chen/Library/Fonts/UbuntuMonoNerdFont-BoldItalic.ttf
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /Users/chen/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control         socket-only
background_opacity           0.95
bold_font                    UbuntuMono Nerd Font Bold
bold_italic_font             UbuntuMono Nerd Font Bold Italic
clipboard_control            ('write-clipboard', 'write-primary', 'read-clipboard-ask', 'read-primary-ask', 'no-append')
cursor_blink_interval        (0.5, kitty.options.utils.EasingFunction(), kitty.options.utils.EasingFunction())
cursor_shape                 3
enabled_layouts              ['splits', 'stack']
font_family                  UbuntuMono Nerd Font Regular
font_size                    15.0
inactive_text_alpha          0.5
italic_font                  UbuntuMono Nerd Font Italic
listen_on                    unix:/tmp/kitty
macos_option_as_alt          3
macos_traditional_fullscreen True
modify_font:
    cell_height 2
scrollback_lines             10000
shell_integration            frozenset({'no-cursor'})
tab_bar_edge                 1
tab_bar_style                powerline
tab_powerline_style          slanted
tab_title_template           {index} {fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}
window_padding_width         FloatEdges(left=1.5, top=1.5, right=1.5, bottom=1.5)
Added shortcuts:
    cmd+backspace →  send_text all \x15
    cmd+left →  send_text all \x01
    cmd+right →  send_text all \x05
    opt+backspace →  send_text all \x17
    shift+cmd+0 →  resize_window reset
    shift+cmd+down →  resize_window shorter 3
    shift+cmd+h →  launch --location=hsplit --cwd=current
    shift+cmd+left →  resize_window narrower 2
    shift+cmd+n →  new_os_window_with_cwd
    shift+cmd+r →  layout_action rotate
    shift+cmd+right →  resize_window wider 2
    shift+cmd+t →  new_tab_with_cwd
    shift+cmd+up →  resize_window taller 3
    shift+cmd+v →  launch --location=vsplit --cwd=current
    shift+cmd+z →  toggle_layout stack
Removed shortcuts:
    cmd+, →  edit_config_file
    cmd+enter →  new_window
    cmd+h →  hide_macos_app
    cmd+k →  clear_terminal to_cursor active
    cmd+m →  minimize_macos_window
    cmd+n →  new_os_window
    cmd+q →  quit
    cmd+t →  new_tab
    cmd+w →  close_tab
    ctrl+cmd+, →  load_config_file
    ctrl+cmd+f →  toggle_fullscreen
    opt+cmd+h →  hide_macos_other_apps
    opt+cmd+r →  clear_terminal reset active
    opt+cmd+s →  toggle_macos_secure_keyboard_entry
    shift+cmd+/ →  open_url https://sw.kovidgoyal.net/kitty/
    shift+cmd+[ →  previous_tab
    shift+cmd+] →  next_tab
    shift+cmd+d →  close_window
    shift+cmd+w →  close_os_window
Changed shortcuts:
    cmd+1 →  send_text all \x1b\x71\x31
    cmd+2 →  send_text all \x1b\x71\x32
    cmd+3 →  send_text all \x1b\x71\x33
    cmd+4 →  send_text all \x1b\x71\x34
    cmd+5 →  send_text all \x1b\x71\x35
    cmd+6 →  send_text all \x1b\x71\x36
    cmd+7 →  send_text all \x1b\x71\x37
    cmd+8 →  send_text all \x1b\x71\x38
    cmd+9 →  send_text all \x1b\x71\x39
    kitty_mod+left →  send_text all\x1b\x71\x70
    kitty_mod+right →  send_text all\x1b\x71\x6e
    shift+cmd+i →  launch --allow-remote-control kitty +kitten broadcast
Colors:
    background                   #2e3440   
    color0                       #3b4252   
    color1                       #bf616a   
    color10                      #a3be8c   
    color11                      #ebcb8b   
    color12                      #81a1c1   
    color13                      #b48ead   
    color14                      #8fbcbb   
    color15                      #eceff4   
    color2                       #a3be8c   
    color3                       #ebcb8b   
    color4                       #81a1c1   
    color5                       #b48ead   
    color6                       #88c0d0   
    color7                       #e5e9f0   
    color8                       #4c566a   
    color9                       #bf616a   
    cursor                       #81a1c1   
    foreground                   #d8dee9   
    tab_bar_background           #444444   

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_GB.UTF-8
    SHELL                               /bin/zsh
    USER                                chen

Additional context Try to reproduce the problem with kitty --config NONE if you cannot then post a minimal kitty.conf that reproduces the problem. If the problem involves interaction with some other terminal program post a minimal config for that program to reproduce the problem as well.

kovidgoyal commented 1 month ago

Mouse wheel works fine for me with

kitty --config NONE nvim --clean

nvim version 0.10.1

I didnt bother trying with tmux.

LittleHendrix commented 1 month ago

kitty --config NONE nvim --clean

Hi @kovidgoyal, thank you for testing this out. However, I've tried the exact command above (no tmux, no nvim plugins) and mouse wheel scrolling still not working for some reason. In your opinion (or, educated guess) would there be any other potential causes that may prevent the mouse wheel from working? I presume there's nothing that stands out in the kitty config that I posted above? I use kitty daily as my dev terminal, would really like to get this working as it did before. Any suggestion would be greatly appreciated!

These are my neovim version details:

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1720049189
LittleHendrix commented 1 month ago

Oh, one more thing to add, which I (literally just) accidentally discovered that, when kitty is in focus, the mouse scrolling isn't working; however, when I move focus to another application, and then hover mouse cursor over kitty terminal and scroll, it works!?! I know that on MacOS you can scroll on window that isn't in focus, as long as the mouse cursor is over it. But I have no idea why it works when out of focus but stops working when in focus 🤷‍♂️

kovidgoyal commented 1 month ago

Make sure you dont have secure text input turned on and you can run kitty using --debug-input to see what input related events it is receiving from the OS.

LittleHendrix commented 1 month ago

@kovidgoyal turning off Secure Keyboard Entry has fixed the issue. 👍 I must have enabled it by clicking the keybind combo by mistake and switched it on without realizing. Thank you for helping to troubleshoot! image