aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-12-03 17:41:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-12-07 19:44:11 +0000
commit5c17b7f8e77f96622d558ccbd5071706863c2816 (patch)
treeb7b7de7a3e86718d9eeaa7cd15588f7feccadfdb
parentime: don’t adjust cursor’s cell-end if it’s equal to the cell-begin (diff)
ime: expand cursor cell-end across multi-cell characters
This fixes an issue where the cursor ended in the middle of e.g double width characters.
-rw-r--r--ime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ime.c b/ime.c
index eb4eadf4..53a908b0 100644
--- a/ime.c
+++ b/ime.c
@@ -290,6 +290,13 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
}
#endif
+ /* Expand cursor end to end of glyph */
+ while (cell_end > cell_begin && cell_end < cell_count &&
+ term->ime.preedit.cells[cell_end].wc == CELL_MULT_COL_SPACER)
+ {
+ cell_end++;
+ }
+
LOG_DBG("pre-edit cursor: begin=%d, end=%d", cell_begin, cell_end);
assert(cell_begin >= 0);