aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-12-02 17:52:50 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-12-07 19:44:10 +0000
commit8c3d48c5cdb2ae4e8bdbdc48f155f53d1a92973b (patch)
tree53a2852bf7d0f2f642932eeeaf3199f5e4dc878c /terminal.c
parentime: wip: commit all changes in ‘done()’ (diff)
ime: render pre-edit text
This is done by allocating cells for the pre-edit text when receiving the text-input::done() call, and populating them by converting the utf-8 formatted pre-edit text to wchars. We also convert the pre-edit cursor position to cell positions (it can cover multiple cells). When rendering, we simply render the pre-edit cells on-top off the regular grid. While doing so, we also mark the underlying, “real”, cells as dirty, to ensure they are re-rendered when the pre-edit text is modified or removed.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index 3bb41d12..d08d8658 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1403,6 +1403,8 @@ term_destroy(struct terminal *term)
tll_free(term->alt.sixel_images);
sixel_fini(term);
+ free(term->ime.preedit.cells);
+
free(term->foot_exe);
free(term->cwd);
@@ -2216,6 +2218,13 @@ term_kbd_focus_out(struct terminal *term)
if (it->item.kbd_focus == term)
return;
+ if (term->ime.preedit.cells != NULL) {
+ free(term->ime.preedit.cells);
+ term->ime.preedit.cells = NULL;
+ term->ime.preedit.count = 0;
+ render_refresh(term);
+ }
+
term->kbd_focus = false;
cursor_refresh(term);