mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
selection: find_word_boundary: ensure row number is bounded
This commit is contained in:
parent
ddf4eb3b78
commit
ca128ae380
1 changed files with 8 additions and 6 deletions
14
selection.c
14
selection.c
|
|
@ -345,12 +345,13 @@ void
|
|||
selection_find_word_boundary_left(const struct terminal *term, struct coord *pos,
|
||||
bool spaces_only)
|
||||
{
|
||||
xassert(pos->row >= 0);
|
||||
xassert(pos->row < term->grid->num_rows);
|
||||
const struct grid *grid = term->grid;
|
||||
|
||||
xassert(pos->col >= 0);
|
||||
xassert(pos->col < term->cols);
|
||||
xassert(pos->row >= 0);
|
||||
pos->row &= grid->num_rows - 1;
|
||||
|
||||
const struct grid *grid = term->grid;
|
||||
const struct row *r = grid->rows[pos->row];
|
||||
char32_t c = r->cells[pos->col].wc;
|
||||
|
||||
|
|
@ -433,12 +434,13 @@ selection_find_word_boundary_right(const struct terminal *term, struct coord *po
|
|||
bool spaces_only,
|
||||
bool stop_on_space_to_word_boundary)
|
||||
{
|
||||
xassert(pos->row >= 0);
|
||||
xassert(pos->row < term->grid->num_rows);
|
||||
const struct grid *grid = term->grid;
|
||||
|
||||
xassert(pos->col >= 0);
|
||||
xassert(pos->col < term->cols);
|
||||
xassert(pos->row >= 0);
|
||||
pos->row &= grid->num_rows - 1;
|
||||
|
||||
const struct grid *grid = term->grid;
|
||||
const struct row *r = grid->rows[pos->row];
|
||||
char32_t c = r->cells[pos->col].wc;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue