Allow optionally dragging URLs with the mouse

Fixes #9804
This commit is contained in:
Kovid Goyal
2026-04-06 10:40:11 +05:30
parent 69e4158259
commit c88adfba98
9 changed files with 82 additions and 15 deletions

View File

@@ -988,6 +988,12 @@ mma('Paste from the primary selection',
mma('Start selecting text',
'start_simple_selection left press ungrabbed mouse_selection normal',
long_text='''
If you would like to drag and drop hyperlinks or detected URLs, instead of
:code:`normal` use :code:`drag_or_normal_select`, then if a hyperlink is under
the mouse it will be dragged based on :opt:`drag_threshold` otherwise a normal
selection will be performed.
'''
)
mma('Start selecting text in a rectangle',

View File

@@ -446,6 +446,7 @@ def mouse_selection(func: str, rest: str) -> FuncArgsType:
'normal': defines.MOUSE_SELECTION_NORMAL,
'extend': defines.MOUSE_SELECTION_EXTEND,
'move-end': defines.MOUSE_SELECTION_MOVE_END,
'move_end': defines.MOUSE_SELECTION_MOVE_END,
'rectangle': defines.MOUSE_SELECTION_RECTANGLE,
'word': defines.MOUSE_SELECTION_WORD,
'line': defines.MOUSE_SELECTION_LINE,
@@ -453,6 +454,7 @@ def mouse_selection(func: str, rest: str) -> FuncArgsType:
'line_from_point': defines.MOUSE_SELECTION_LINE_FROM_POINT,
'word_and_line_from_point': defines.MOUSE_SELECTION_WORD_AND_LINE_FROM_POINT,
'upto_surrounding_whitespace': defines.MOUSE_SELECTION_UPTO_SURROUNDING_WHITESPACE,
'drag_or_normal_select': defines.MOUSE_SELECTION_NORMAL - 1,
}
setattr(mouse_selection, 'code_map', cmap)
return func, [cmap[rest]]