From 5e013cad78a1989f4deb0972a465dfcdad0dc1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 27 Sep 2023 16:23:30 +0200 Subject: [PATCH] selection: selection_update() uses view-local coordinates --- selection.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/selection.c b/selection.c index 7b508828..8a3fd781 100644 --- a/selection.c +++ b/selection.c @@ -684,7 +684,16 @@ selection_start(struct terminal *term, int col, int row, term->selection.pivot.start = term->selection.coords.start; term->selection.pivot.end = end; - selection_update(term, end.col, end.row); + /* + * FIXME: go through selection.c and make sure all public + * functions use the *same* coordinate system... + * + * selection_find_word_boundary*() uses absolute row numbers, + * while selection_update(), and pretty much all others, use + * view-local. + */ + + selection_update(term, end.col, end.row - term->grid->view); break; } @@ -1100,15 +1109,11 @@ set_pivot_point_for_block_and_char_wise(struct terminal *term, void selection_update(struct terminal *term, int col, int row) { - if (term->selection.coords.start.row < 0) { - LOG_ERR("NO SELECTION"); + if (term->selection.coords.start.row < 0) return; - } - if (!term->selection.ongoing) { - LOG_ERR("NOT ON-GOING"); + if (!term->selection.ongoing) return; - } xassert(term->grid->view + row != -1);