From 4d2bc54fa216dfda98c4b228b9576dcad471858c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 11 Aug 2020 10:17:19 +0200 Subject: config: mouse bindings: add select-begin-block and select-row --- input.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 9e260e69..518a690b 100644 --- a/input.c +++ b/input.c @@ -255,11 +255,22 @@ execute_binding(struct seat *seat, struct terminal *term, } case BIND_ACTION_SELECT_BEGIN: - selection_start( - term, seat->mouse.col, seat->mouse.row, - seat->kbd.ctrl ? SELECTION_BLOCK : SELECTION_NORMAL); + selection_start(term, seat->mouse.col, seat->mouse.row, SELECTION_NORMAL); break; + case BIND_ACTION_SELECT_BEGIN_BLOCK: + selection_start(term, seat->mouse.col, seat->mouse.row, SELECTION_BLOCK); + break; + + case BIND_ACTION_SELECT_EXTEND: { + bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; + if (selection_enabled(term, seat) && cursor_is_on_grid) { + selection_extend( + seat, term, seat->mouse.col, seat->mouse.row, serial); + } + break; + } + case BIND_ACTION_SELECT_WORD: selection_mark_word( seat, term, seat->mouse.col, seat->mouse.row, false, serial); @@ -270,14 +281,10 @@ execute_binding(struct seat *seat, struct terminal *term, seat, term, seat->mouse.col, seat->mouse.row, true, serial); break; - case BIND_ACTION_SELECT_EXTEND: { - bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; - if (selection_enabled(term, seat) && cursor_is_on_grid) { - selection_extend( - seat, term, seat->mouse.col, seat->mouse.row, serial); - } + case BIND_ACTION_SELECT_ROW: + selection_mark_row(seat, term, seat->mouse.row, serial); break; - } + case BIND_ACTION_COUNT: assert(false); @@ -1279,10 +1286,8 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; /* Update selection */ - if (seat->mouse.button == BTN_LEFT || seat->mouse.button == BTN_RIGHT) { - if (cursor_is_on_new_cell || term->selection.end.row < 0) - selection_update(term, selection_col, selection_row); - } + if (cursor_is_on_new_cell || term->selection.end.row < 0) + selection_update(term, selection_col, selection_row); /* Send mouse event to client application */ if (!term_mouse_grabbed(term, seat) && -- cgit v1.3