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
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`) - 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] 0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -983,6 +983,14 @@ boundary, use :code:`move-end` instead of :code:`extend`.
''' '''
) )
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', mma('Paste from the primary selection even when grabbed',
'paste_selection_grabbed shift+middle release ungrabbed,grabbed paste_selection', 'paste_selection_grabbed shift+middle release ungrabbed,grabbed paste_selection',
) )
@@ -992,7 +1000,7 @@ mma('Discard press event for middle click paste',
) )
mma('Start selecting text even when grabbed', 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', mma('Start selecting text in a rectangle even when grabbed',

View File

@@ -1090,6 +1090,8 @@ defaults.mouse_map = [
MouseMapping(mods=6, repeat_count=3, definition='mouse_selection line_from_point'), MouseMapping(mods=6, repeat_count=3, definition='mouse_selection line_from_point'),
# extend_selection # extend_selection
MouseMapping(button=1, definition='mouse_selection extend'), MouseMapping(button=1, definition='mouse_selection extend'),
# extend_selection_shift
MouseMapping(mods=1, definition='mouse_selection extend'),
# paste_selection_grabbed # paste_selection_grabbed
MouseMapping(button=2, mods=1, repeat_count=-1, grabbed=True, definition='paste_selection'), MouseMapping(button=2, mods=1, repeat_count=-1, grabbed=True, definition='paste_selection'),
# paste_selection_grabbed # paste_selection_grabbed
@@ -1098,8 +1100,6 @@ defaults.mouse_map = [
MouseMapping(button=2, mods=1, grabbed=True, definition='discard_event'), MouseMapping(button=2, mods=1, grabbed=True, definition='discard_event'),
# start_simple_selection_grabbed # start_simple_selection_grabbed
MouseMapping(mods=1, grabbed=True, definition='mouse_selection normal'), MouseMapping(mods=1, grabbed=True, definition='mouse_selection normal'),
# start_simple_selection_grabbed
MouseMapping(mods=1, definition='mouse_selection normal'),
# start_rectangle_selection_grabbed # start_rectangle_selection_grabbed
MouseMapping(mods=7, grabbed=True, definition='mouse_selection rectangle'), MouseMapping(mods=7, grabbed=True, definition='mouse_selection rectangle'),
# start_rectangle_selection_grabbed # start_rectangle_selection_grabbed