selection: find_word_boundary{left,right}: handle composed characters

This commit is contained in:
Daniel Eklöf 2021-01-03 13:09:24 +01:00
parent 736ff0421c
commit c821914e67
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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)))