diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-03 12:09:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-04 18:48:41 +0000 |
| commit | c821914e67d920f4f4a2abdc7a0dc84464ea820b (patch) | |
| tree | 06fe3a1bed88a3a59715c944b9c6d0a541beb4f4 /selection.c | |
| parent | selection: find_word_boundary_{left,right}: treat spacers as word chars (diff) | |
selection: find_word_boundary{left,right}: handle composed characters
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/selection.c b/selection.c index da89b006..0f856c78 100644 --- a/selection.c +++ b/selection.c @@ -243,6 +243,12 @@ 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 >= CELL_COMB_CHARS_LO && + c < (CELL_COMB_CHARS_LO + term->composed_count)) + { + c = term->composed[c - CELL_COMB_CHARS_LO].base; + } + if (!(c != CELL_MULT_COL_SPACER && (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters)))) { @@ -260,6 +266,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 >= CELL_COMB_CHARS_LO && + c < (CELL_COMB_CHARS_LO + term->composed_count)) + { + c = term->composed[c - CELL_COMB_CHARS_LO].base; + } + if (c != CELL_MULT_COL_SPACER && (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) @@ -280,6 +292,12 @@ 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 >= CELL_COMB_CHARS_LO && + c < (CELL_COMB_CHARS_LO + term->composed_count)) + { + c = term->composed[c - CELL_COMB_CHARS_LO].base; + } + if (!(c != CELL_MULT_COL_SPACER && (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters)))) { @@ -297,6 +315,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 >= CELL_COMB_CHARS_LO && + c < (CELL_COMB_CHARS_LO + term->composed_count)) + { + c = term->composed[c - CELL_COMB_CHARS_LO].base; + } + if (c != CELL_MULT_COL_SPACER && (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) |
