selection: add start/end coordinate getters

Internally, selection coordinates are *unbounded* (that is, the row
numbers may be larger than grid->num_rows) while a selection is
ongoing. Only after it has been finalized are the coordinates bounded.

This means it isn’t safe to use term->selection.coords.* directly.
This commit is contained in:
Daniel Eklöf 2022-04-25 19:59:23 +02:00
parent b4f666118f
commit 6316a5eb0c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 27 additions and 0 deletions

View file

@ -79,3 +79,6 @@ void selection_find_word_boundary_left(
struct terminal *term, struct coord *pos, bool spaces_only);
void selection_find_word_boundary_right(
struct terminal *term, struct coord *pos, bool spaces_only);
struct coord selection_get_start(const struct terminal *term);
struct coord selection_get_end(const struct terminal *term);