diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-03 12:04:31 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-04 18:48:41 +0000 |
| commit | 736ff0421cc607a315e0bf5264f2633a0d4d80d4 (patch) | |
| tree | 42aa94293a89522a8bd1d90204a4e6c1aecdec52 | |
| parent | selection: use selection_start() to initialize word/row-based selection (diff) | |
selection: find_word_boundary_{left,right}: treat spacers as word chars
| -rw-r--r-- | selection.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/selection.c b/selection.c index 4b7baf13..da89b006 100644 --- a/selection.c +++ b/selection.c @@ -243,7 +243,9 @@ find_word_boundary_left(struct terminal *term, struct coord *pos, const struct row *r = grid_row_in_view(term->grid, pos->row); wchar_t c = r->cells[pos->col].wc; - if (!(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) { + if (!(c != CELL_MULT_COL_SPACER && + (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters)))) + { while (true) { int next_col = pos->col - 1; int next_row = pos->row; @@ -258,8 +260,12 @@ find_word_boundary_left(struct terminal *term, struct coord *pos, const struct row *row = grid_row_in_view(term->grid, next_row); c = row->cells[next_col].wc; - if (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters)) + if (c != CELL_MULT_COL_SPACER && + (c == 0 || + !isword(c, spaces_only, term->conf->word_delimiters))) + { break; + } pos->col = next_col; pos->row = next_row; @@ -274,7 +280,9 @@ find_word_boundary_right(struct terminal *term, struct coord *pos, const struct row *r = grid_row_in_view(term->grid, pos->row); wchar_t c = r->cells[pos->col].wc; - if (!(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) { + if (!(c != CELL_MULT_COL_SPACER && + (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters)))) + { while (true) { int next_col = pos->col + 1; int next_row = pos->row; @@ -289,8 +297,12 @@ find_word_boundary_right(struct terminal *term, struct coord *pos, const struct row *row = grid_row_in_view(term->grid, next_row); c = row->cells[next_col].wc; - if (c == '\0' || !isword(c, spaces_only, term->conf->word_delimiters)) + if (c != CELL_MULT_COL_SPACER && + (c == 0 || + !isword(c, spaces_only, term->conf->word_delimiters))) + { break; + } pos->col = next_col; pos->row = next_row; |
