diff --git a/kitty/char_grid.py b/kitty/char_grid.py index d25a8d3de..580c8ce67 100644 --- a/kitty/char_grid.py +++ b/kitty/char_grid.py @@ -400,7 +400,10 @@ class CharGrid: s.end_x = self.screen.columns - 1 elif count == 2: i = x - pat = re.compile(r'\w') + alphanumeric = 'A-Za-z0-9' + optionalchars = re.escape(self.opts.select_by_word_characters) + pattern = alphanumeric + optionalchars + pat = re.compile(r'['+pattern+']+') while i >= 0 and pat.match(line[i]) is not None: i -= 1 s.start_x = i if i == x else i + 1 diff --git a/kitty/config.py b/kitty/config.py index 5296959cd..1109bd20f 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -105,6 +105,7 @@ type_map = { 'window_border_width': float, 'wheel_scroll_multiplier': float, 'click_interval': float, + 'select_by_word_characters': str, 'mouse_hide_wait': float, 'cursor_blink_interval': float, 'cursor_stop_blinking_after': float, diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 71db31ca6..3c2de4446 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -52,6 +52,9 @@ wheel_scroll_multiplier 5.0 # The interval between successive clicks to detect double/triple clicks (in seconds) click_interval 0.5 +# Characters considered part of a word when double clicking +select_by_word_characters :@-./_~?&=%+# + # Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to # zero or a negative number to disable mouse cursor hiding. mouse_hide_wait 3.0