aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-06-24 15:50:55 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-06-24 15:50:55 +0000
commit80c2d9d89df11c5830de900f98b5d9f3f406a1c1 (patch)
treea27132ebbd0940872c16afd3f48f4ee791820a0a /selection.c
parentMerge branch 'sixel-heap-user-after-free-after-blending' (diff)
parentclient: add +/-graphemes to version output (diff)
Merge branch 'harfbuzz'
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/selection.c b/selection.c
index 555b32f2..57ab8bf6 100644
--- a/selection.c
+++ b/selection.c
@@ -246,11 +246,8 @@ selection_find_word_boundary_left(struct terminal *term, struct coord *pos,
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_COMB_CHARS_LO && c <= CELL_COMB_CHARS_HI)
+ c = composed_lookup(term->composed, c - CELL_COMB_CHARS_LO)->chars[0];
bool initial_is_space = c == 0 || iswspace(c);
bool initial_is_delim =
@@ -286,11 +283,8 @@ selection_find_word_boundary_left(struct terminal *term, struct coord *pos,
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_COMB_CHARS_LO && c <= CELL_COMB_CHARS_HI)
+ c = composed_lookup(term->composed, c - CELL_COMB_CHARS_LO)->chars[0];
bool is_space = c == 0 || iswspace(c);
bool is_delim =
@@ -325,11 +319,8 @@ selection_find_word_boundary_right(struct terminal *term, struct coord *pos,
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_COMB_CHARS_LO && c <= CELL_COMB_CHARS_HI)
+ c = composed_lookup(term->composed, c - CELL_COMB_CHARS_LO)->chars[0];
bool initial_is_space = c == 0 || iswspace(c);
bool initial_is_delim =
@@ -367,11 +358,8 @@ selection_find_word_boundary_right(struct terminal *term, struct coord *pos,
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_COMB_CHARS_LO && c <= CELL_COMB_CHARS_HI)
+ c = composed_lookup(term->composed, c - CELL_COMB_CHARS_LO)->chars[0];
bool is_space = c == 0 || iswspace(c);
bool is_delim =