Skip to content

Delay when placing cursor with mouse click #7601

@ColdNSs

Description

@ColdNSs

Describe the bug
There is a noticeable delay between clicking the mouse to place the cursor and the cursor actually moving to the clicked position.

To Reproduce

  1. Open Kitty terminal.
  2. Start typing in the terminal.
  3. Use the mouse to click on a specific position within the command line.
  4. Observe the delay before the cursor moves to the clicked position. During this delay, any keys inputted are added at the old cursor position instead of the intended new position.

Debug Keyboard

[20.263] Press mouse_button: 0 mods: none grabbed: 0
[20.263] MouseEvent matched action: mouse_selection
[20.263] on_mouse_input: press button: left mods: none grabbed: 0 handled_in_kitty: 1
[20.334] Release mouse_button: 0 mods: none handled as drag end
[20.385] Press xkb_keycode: 0x3 clean_sym: 2 composed_sym: 2 text: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.385] on_key_input: glfw key: 0x32 native_code: 0x32 action: PRESS mods: none text: '2' state: 0 sent key as text to child: 2
[20.469] Release xkb_keycode: 0x3 clean_sym: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.469] on_key_input: glfw key: 0x32 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
[20.553] Press xkb_keycode: 0x3 clean_sym: 2 composed_sym: 2 text: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.553] on_key_input: glfw key: 0x32 native_code: 0x32 action: PRESS mods: none text: '2' state: 0 sent key as text to child: 2
[20.636] Release xkb_keycode: 0x3 clean_sym: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.636] on_key_input: glfw key: 0x32 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
[20.721] Press xkb_keycode: 0x3 clean_sym: 2 composed_sym: 2 text: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.722] on_key_input: glfw key: 0x32 native_code: 0x32 action: PRESS mods: none text: '2' state: 0 sent key as text to child: 2
[20.794] Release xkb_keycode: 0x3 clean_sym: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.794] on_key_input: glfw key: 0x32 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
[20.835] MouseEvent matched action: mouse_handle_click
[20.835] on_mouse_input: click button: left mods: none grabbed: 0 handled_in_kitty: 1
[20.889] Press xkb_keycode: 0x3 clean_sym: 2 composed_sym: 2 text: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.889] on_key_input: glfw key: 0x32 native_code: 0x32 action: PRESS mods: none text: '2' state: 0 sent key as text to child: 2
[20.969] Release xkb_keycode: 0x3 clean_sym: 2 mods: none glfw_key: 50 (2) xkb_key: 50 (2)
[20.969] on_key_input: glfw key: 0x32 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event

As you can see when I keep spamming 2 after a left mouse button click, there's about half a second delay until mouse event is actually handled.

Screenshots
None.

Environment details

kitty 0.35.2 created by Kovid Goyal
Linux ZenCascade 6.9.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 04:32:50 +0000 x86_64
Arch Linux 6.9.7-arch1-1 (/dev/tty)

DISTRIB_ID="Arch"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="Arch Linux"
Running under: Wayland (Hyprland v0.41.2,) missing: single_pixel_buffer
OpenGL: '4.6 (Core Profile) Mesa 24.1.3-arch1.1' Detected version: 4.6
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/bash
Loaded config files:
  /home/coldn/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity      0.95
confirm_os_window_close 0
enable_audio_bell       False
font_family             jetbrains mono nerd font
font_size               15.0
mouse_hide_wait         2.0
shell_integration       frozenset({'no-cursor'})
url_style               4
wayland_enable_ime      False
Colors:
	active_border_color     #b4befe   
	active_tab_background   #cba6f7   
	active_tab_foreground   #11111b   
	background              #1e1e2e   
	bell_border_color       #f9e2af   
	color0                  #45475a   
	color1                  #f38ba8   
	color10                 #a6e3a1   
	color11                 #f9e2af   
	color12                 #89b4fa   
	color13                 #f5c2e7   
	color14                 #94e2d5   
	color15                 #a6adc8   
	color2                  #a6e3a1   
	color3                  #f9e2af   
	color4                  #89b4fa   
	color5                  #f5c2e7   
	color6                  #94e2d5   
	color7                  #bac2de   
	color8                  #585b70   
	color9                  #f38ba8   
	cursor                  #f5e0dc   
	cursor_text_color       #1e1e2e   
	foreground              #cdd6f4   
	inactive_border_color   #6c7086   
	inactive_tab_background #181825   
	inactive_tab_foreground #cdd6f4   
	mark1_background        #b4befe   
	mark1_foreground        #1e1e2e   
	mark2_background        #cba6f7   
	mark2_foreground        #1e1e2e   
	mark3_background        #74c7ec   
	mark3_foreground        #1e1e2e   
	selection_background    #f5e0dc   
	selection_foreground    #1e1e2e   
	tab_bar_background      #11111b   

Important environment variables seen by the kitty process:
	PATH                                /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
	LANG                                en_US.UTF-8
	SHELL                               /bin/bash
	GLFW_IM_MODULE                      ibus
	DISPLAY                             :1
	WAYLAND_DISPLAY                     wayland-1
	USER                                coldn
	XDG_SESSION_PATH                    /org/freedesktop/DisplayManager/Session1
	XDG_BACKEND                         wayland
	XDG_SEAT                            seat0
	XDG_SESSION_DESKTOP                 Hyprland
	XDG_SESSION_TYPE                    wayland
	XDG_CURRENT_DESKTOP                 Hyprland
	XDG_SEAT_PATH                       /org/freedesktop/DisplayManager/Seat0
	XDG_SESSION_CLASS                   user
	XDG_VTNR                            1
	XDG_SESSION_ID                      2
	XDG_RUNTIME_DIR                     /run/user/1000

Additional context
The problem still exists with kitty --config NONE .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions