Allow extending selections by dragging with right button pressed
Fixes #2445
This commit is contained in:
parent
7329bd4910
commit
9c19e88288
@ -71,6 +71,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
|
||||
- Fix selection not updating properly while scrolling (:iss:`2442`)
|
||||
|
||||
- Allow extending selections by dragging with right button pressed
|
||||
(:iss:`2445`)
|
||||
|
||||
- Workaround for bug in less that causes colors to reset at wrapped lines
|
||||
(:iss:`2381`)
|
||||
|
||||
|
||||
@ -217,10 +217,10 @@ drag_scroll(Window *w, OSWindow *frame) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
extend_selection(Window *w) {
|
||||
extend_selection(Window *w, bool ended) {
|
||||
Screen *screen = w->render_data.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, true, false);
|
||||
screen_update_selection(screen, w->mouse_pos.cell_x, w->mouse_pos.cell_y, w->mouse_pos.in_left_half_of_cell, ended, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ detect_url(Screen *screen, unsigned int x, unsigned int y) {
|
||||
static inline void
|
||||
handle_mouse_movement_in_kitty(Window *w, int button, bool mouse_cell_changed) {
|
||||
Screen *screen = w->render_data.screen;
|
||||
if (screen->selection.in_progress && button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
if (screen->selection.in_progress && (button == GLFW_MOUSE_BUTTON_LEFT || button == GLFW_MOUSE_BUTTON_RIGHT)) {
|
||||
monotonic_t now = monotonic();
|
||||
if ((now - w->last_drag_scroll_at) >= ms_to_monotonic_t(20ll) || mouse_cell_changed) {
|
||||
update_drag(false, w, false, 0);
|
||||
@ -427,7 +427,7 @@ handle_button_event_in_kitty(Window *w, int button, int modifiers, bool is_relea
|
||||
if (is_release) { call_boss(paste_from_selection, NULL); return; }
|
||||
break;
|
||||
case GLFW_MOUSE_BUTTON_RIGHT:
|
||||
if (is_release) { extend_selection(w); }
|
||||
extend_selection(w, is_release);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2217,7 +2217,7 @@ screen_mark_url(Screen *self, index_type start_x, index_type start_y, index_type
|
||||
|
||||
void
|
||||
screen_update_selection(Screen *self, index_type x, index_type y, bool in_left_half_of_cell, bool ended, bool start_extended_selection) {
|
||||
if (ended) self->selection.in_progress = false;
|
||||
self->selection.in_progress = !ended;
|
||||
self->selection.input_current.x = x; self->selection.input_current.y = y;
|
||||
self->selection.input_current.in_left_half_of_cell = in_left_half_of_cell;
|
||||
self->selection.end_scrolled_by = self->scrolled_by;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user