selection: selection_update() uses view-local coordinates

This commit is contained in:
Daniel Eklöf 2023-09-27 16:23:30 +02:00
parent 78665a7e80
commit 5e013cad78
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -684,7 +684,16 @@ selection_start(struct terminal *term, int col, int row,
term->selection.pivot.start = term->selection.coords.start; term->selection.pivot.start = term->selection.coords.start;
term->selection.pivot.end = end; 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; break;
} }
@ -1100,15 +1109,11 @@ set_pivot_point_for_block_and_char_wise(struct terminal *term,
void void
selection_update(struct terminal *term, int col, int row) selection_update(struct terminal *term, int col, int row)
{ {
if (term->selection.coords.start.row < 0) { if (term->selection.coords.start.row < 0)
LOG_ERR("NO SELECTION");
return; return;
}
if (!term->selection.ongoing) { if (!term->selection.ongoing)
LOG_ERR("NOT ON-GOING");
return; return;
}
xassert(term->grid->view + row != -1); xassert(term->grid->view + row != -1);