aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-23 10:23:27 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-24 18:17:29 +0000
commit8c0fca30db83576f7df5d48c94ecfa9896f8a075 (patch)
treece6e644c37c3c361d32d4fb4d411debac2e527d7 /selection.c
parentchangelog: UI not refreshing when pasting into the scrollback search box (diff)
selection: find_word_boundary: assert ‘pos’ is valid
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/selection.c b/selection.c
index f279a834..da62d354 100644
--- a/selection.c
+++ b/selection.c
@@ -270,6 +270,11 @@ void
selection_find_word_boundary_left(struct terminal *term, struct coord *pos,
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);
char32_t c = r->cells[pos->col].wc;
@@ -343,6 +348,11 @@ void
selection_find_word_boundary_right(struct terminal *term, struct coord *pos,
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);
char32_t c = r->cells[pos->col].wc;