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.
This commit is contained in:
Daniel Eklöf 2020-12-03 18:41:42 +01:00
parent 001c82fa54
commit 5c17b7f8e7
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

7
ime.c
View file

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