From fcdc67a3566b2ca96acf6ec989f433b411b4c7be Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Mar 2026 11:00:43 +0530 Subject: [PATCH] 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 --- docs/changelog.rst | 3 +++ kitty/options/definition.py | 10 +++++++++- kitty/options/types.py | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 367862cab..b8fc72276 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 39b1fdb2b..35845be98 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -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', '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', - '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', diff --git a/kitty/options/types.py b/kitty/options/types.py index 429a643ed..3502d2fce 100644 --- a/kitty/options/types.py +++ b/kitty/options/types.py @@ -1090,6 +1090,8 @@ defaults.mouse_map = [ 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 @@ defaults.mouse_map = [ 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