mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Add an action to restore move-end behavior when extending selections
This commit is contained in:
@@ -9,6 +9,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
|
|
||||||
- Add a new :ref:`action-toggle_layout` action to easily zoom/unzoom a window
|
- Add a new :ref:`action-toggle_layout` action to easily zoom/unzoom a window
|
||||||
|
|
||||||
|
- When right clicking to extend a selection, move the nearest selection
|
||||||
|
boundary rather than the end of the selection. To restore previous behavior
|
||||||
|
use ``mouse_map right press ungrabbed mouse_selection move-end``.
|
||||||
|
|
||||||
- Fix a bug in the implementation of the synchronized updates escape code that
|
- Fix a bug in the implementation of the synchronized updates escape code that
|
||||||
could cause incorrect parsing if either the pending buffer capacity or the
|
could cause incorrect parsing if either the pending buffer capacity or the
|
||||||
pending timeout were exceeded (:iss:`3779`)
|
pending timeout were exceeded (:iss:`3779`)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ MOUSE_SELECTION_NORMAL: int
|
|||||||
MOUSE_SELECTION_WORD: int
|
MOUSE_SELECTION_WORD: int
|
||||||
MOUSE_SELECTION_RECTANGLE: int
|
MOUSE_SELECTION_RECTANGLE: int
|
||||||
MOUSE_SELECTION_LINE_FROM_POINT: int
|
MOUSE_SELECTION_LINE_FROM_POINT: int
|
||||||
|
MOUSE_SELECTION_MOVE_END: int
|
||||||
KITTY_VCS_REV: str
|
KITTY_VCS_REV: str
|
||||||
NO_CLOSE_REQUESTED: int
|
NO_CLOSE_REQUESTED: int
|
||||||
IMPERATIVE_CLOSE_REQUESTED: int
|
IMPERATIVE_CLOSE_REQUESTED: int
|
||||||
|
|||||||
@@ -281,11 +281,11 @@ drag_scroll(Window *w, OSWindow *frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
extend_selection(Window *w, bool ended) {
|
extend_selection(Window *w, bool ended, bool extend_nearest) {
|
||||||
Screen *screen = w->render_data.screen;
|
Screen *screen = w->render_data.screen;
|
||||||
if (screen_has_selection(screen)) {
|
if (screen_has_selection(screen)) {
|
||||||
screen_update_selection(screen, w->mouse_pos.cell_x, w->mouse_pos.cell_y, w->mouse_pos.in_left_half_of_cell,
|
screen_update_selection(screen, w->mouse_pos.cell_x, w->mouse_pos.cell_y, w->mouse_pos.in_left_half_of_cell,
|
||||||
(SelectionUpdate){.ended=ended, .set_as_nearest_extend=true});
|
(SelectionUpdate){.ended=ended, .set_as_nearest_extend=extend_nearest});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,6 +590,7 @@ typedef enum MouseSelectionType {
|
|||||||
MOUSE_SELECTION_WORD,
|
MOUSE_SELECTION_WORD,
|
||||||
MOUSE_SELECTION_LINE,
|
MOUSE_SELECTION_LINE,
|
||||||
MOUSE_SELECTION_LINE_FROM_POINT,
|
MOUSE_SELECTION_LINE_FROM_POINT,
|
||||||
|
MOUSE_SELECTION_MOVE_END,
|
||||||
} MouseSelectionType;
|
} MouseSelectionType;
|
||||||
|
|
||||||
|
|
||||||
@@ -621,7 +622,10 @@ mouse_selection(Window *w, int code, int button) {
|
|||||||
if (screen_selection_range_for_line(screen, w->mouse_pos.cell_y, &start, &end) && end > w->mouse_pos.cell_x) S(EXTEND_LINE_FROM_POINT);
|
if (screen_selection_range_for_line(screen, w->mouse_pos.cell_y, &start, &end) && end > w->mouse_pos.cell_x) S(EXTEND_LINE_FROM_POINT);
|
||||||
break;
|
break;
|
||||||
case MOUSE_SELECTION_EXTEND:
|
case MOUSE_SELECTION_EXTEND:
|
||||||
extend_selection(w, false);
|
extend_selection(w, false, true);
|
||||||
|
break;
|
||||||
|
case MOUSE_SELECTION_MOVE_END:
|
||||||
|
extend_selection(w, false, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
set_mouse_cursor_when_dragging();
|
set_mouse_cursor_when_dragging();
|
||||||
@@ -863,6 +867,7 @@ init_mouse(PyObject *module) {
|
|||||||
PyModule_AddIntMacro(module, MOUSE_SELECTION_WORD);
|
PyModule_AddIntMacro(module, MOUSE_SELECTION_WORD);
|
||||||
PyModule_AddIntMacro(module, MOUSE_SELECTION_LINE);
|
PyModule_AddIntMacro(module, MOUSE_SELECTION_LINE);
|
||||||
PyModule_AddIntMacro(module, MOUSE_SELECTION_LINE_FROM_POINT);
|
PyModule_AddIntMacro(module, MOUSE_SELECTION_LINE_FROM_POINT);
|
||||||
|
PyModule_AddIntMacro(module, MOUSE_SELECTION_MOVE_END);
|
||||||
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,6 +548,7 @@ mma('Select line from point',
|
|||||||
|
|
||||||
mma('Extend the current selection',
|
mma('Extend the current selection',
|
||||||
'extend_selection right press ungrabbed mouse_selection extend',
|
'extend_selection right 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 move-end instead of extend.'
|
||||||
)
|
)
|
||||||
|
|
||||||
mma('Paste from the primary selection even when grabbed',
|
mma('Paste from the primary selection even when grabbed',
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ def mouse_selection(func: str, rest: str) -> FuncArgsType:
|
|||||||
cmap = {
|
cmap = {
|
||||||
'normal': defines.MOUSE_SELECTION_NORMAL,
|
'normal': defines.MOUSE_SELECTION_NORMAL,
|
||||||
'extend': defines.MOUSE_SELECTION_EXTEND,
|
'extend': defines.MOUSE_SELECTION_EXTEND,
|
||||||
|
'move-end': defines.MOUSE_SELECTION_MOVE_END,
|
||||||
'rectangle': defines.MOUSE_SELECTION_RECTANGLE,
|
'rectangle': defines.MOUSE_SELECTION_RECTANGLE,
|
||||||
'word': defines.MOUSE_SELECTION_WORD,
|
'word': defines.MOUSE_SELECTION_WORD,
|
||||||
'line': defines.MOUSE_SELECTION_LINE,
|
'line': defines.MOUSE_SELECTION_LINE,
|
||||||
|
|||||||
Reference in New Issue
Block a user