mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
selection: find_word_boundary: assert ‘pos’ is valid
This commit is contained in:
parent
47d1ba58e5
commit
8c0fca30db
1 changed files with 10 additions and 0 deletions
10
selection.c
10
selection.c
|
|
@ -270,6 +270,11 @@ void
|
||||||
selection_find_word_boundary_left(struct terminal *term, struct coord *pos,
|
selection_find_word_boundary_left(struct terminal *term, struct coord *pos,
|
||||||
bool spaces_only)
|
bool spaces_only)
|
||||||
{
|
{
|
||||||
|
xassert(pos->row >= 0);
|
||||||
|
xassert(pos->row < term->rows);
|
||||||
|
xassert(pos->col >= 0);
|
||||||
|
xassert(pos->col < term->cols);
|
||||||
|
|
||||||
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
||||||
char32_t c = r->cells[pos->col].wc;
|
char32_t c = r->cells[pos->col].wc;
|
||||||
|
|
||||||
|
|
@ -343,6 +348,11 @@ void
|
||||||
selection_find_word_boundary_right(struct terminal *term, struct coord *pos,
|
selection_find_word_boundary_right(struct terminal *term, struct coord *pos,
|
||||||
bool spaces_only)
|
bool spaces_only)
|
||||||
{
|
{
|
||||||
|
xassert(pos->row >= 0);
|
||||||
|
xassert(pos->row < term->rows);
|
||||||
|
xassert(pos->col >= 0);
|
||||||
|
xassert(pos->col < term->cols);
|
||||||
|
|
||||||
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
||||||
char32_t c = r->cells[pos->col].wc;
|
char32_t c = r->cells[pos->col].wc;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue