diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-03 14:15:34 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-04 18:48:43 +0000 |
| commit | 683f63c92992da8d9277a0a29c04bbf217241e57 (patch) | |
| tree | de2e8168bc6a55e685ba0d1fec2e7f7ad6f99318 /selection.c | |
| parent | selection: find_word_boundary_{left,right}: try to make the code more readable (diff) | |
selection: update: find_word_boundary_{left,right}: coordinates are screen local
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/selection.c b/selection.c index df643486..05080561 100644 --- a/selection.c +++ b/selection.c @@ -667,13 +667,19 @@ selection_update(struct terminal *term, int col, int row) case SELECTION_SEMANTIC_WORD: switch (term->selection.direction) { - case SELECTION_LEFT: - find_word_boundary_left(term, &new_end, term->selection.spaces_only); + case SELECTION_LEFT: { + struct coord end = {col, row}; + find_word_boundary_left(term, &end, term->selection.spaces_only); + new_end = (struct coord){end.col, term->grid->view + end.row}; break; + } - case SELECTION_RIGHT: - find_word_boundary_right(term, &new_end, term->selection.spaces_only); + case SELECTION_RIGHT: { + struct coord end = {col, row}; + find_word_boundary_right(term, &end, term->selection.spaces_only); + new_end = (struct coord){end.col, term->grid->view + end.row}; break; + } case SELECTION_UNDIR: break; |
