Make shift+left click extend the current selection instead of starting a new selection when the mouse is not grabbed by the TUI application

Matches behavior common to most GUI applications and other terminal
emulators. Can be reverted to previous behavior easily.

See https://github.com/kovidgoyal/kitty/discussions/9608
This commit is contained in:
Kovid Goyal 2026-03-05 11:00:43 +05:30
parent e1a14551fa
commit fcdc67a356
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 14 additions and 3 deletions

View file

@ -264,6 +264,9 @@ Detailed list of changes
- Cursor trail: Show a cursor trail when switching tabs (:pull:`9588`)
- Make shift+left click extend the current selection instead of starting a new
selection when the mouse is not grabbed by the TUI application (:disc:`9608`)
0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -983,6 +983,14 @@
'''
)
mma('Extend the current selection with shift',
'extend_selection_shift shift+left press ungrabbed mouse_selection extend',
long_text='''
If you want only the end of the selection to be moved instead of the nearest
boundary, use :code:`move-end` instead of :code:`extend`.
'''
)
mma('Paste from the primary selection even when grabbed',
'paste_selection_grabbed shift+middle release ungrabbed,grabbed paste_selection',
)
@ -992,7 +1000,7 @@
)
mma('Start selecting text even when grabbed',
'start_simple_selection_grabbed shift+left press ungrabbed,grabbed mouse_selection normal',
'start_simple_selection_grabbed shift+left press grabbed mouse_selection normal',
)
mma('Start selecting text in a rectangle even when grabbed',

View file

@ -1090,6 +1090,8 @@ def __setattr__(self, key: str, val: typing.Any) -> typing.Any:
MouseMapping(mods=6, repeat_count=3, definition='mouse_selection line_from_point'),
# extend_selection
MouseMapping(button=1, definition='mouse_selection extend'),
# extend_selection_shift
MouseMapping(mods=1, definition='mouse_selection extend'),
# paste_selection_grabbed
MouseMapping(button=2, mods=1, repeat_count=-1, grabbed=True, definition='paste_selection'),
# paste_selection_grabbed
@ -1098,8 +1100,6 @@ def __setattr__(self, key: str, val: typing.Any) -> typing.Any:
MouseMapping(button=2, mods=1, grabbed=True, definition='discard_event'),
# start_simple_selection_grabbed
MouseMapping(mods=1, grabbed=True, definition='mouse_selection normal'),
# start_simple_selection_grabbed
MouseMapping(mods=1, definition='mouse_selection normal'),
# start_rectangle_selection_grabbed
MouseMapping(mods=7, grabbed=True, definition='mouse_selection rectangle'),
# start_rectangle_selection_grabbed