aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-09-27 14:23:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-10-08 08:38:38 +0000
commit5e013cad78a1989f4deb0972a465dfcdad0dc1d2 (patch)
tree388d4ad5b5a05b0552a8ffa7119d7e8c5a477815
parentsearch: add more key bindings to extend the current match (diff)
selection: selection_update() uses view-local coordinates
-rw-r--r--selection.c19
1 files 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);