mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-28 01:40:17 -05:00
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.
This commit is contained in:
parent
5745c610ac
commit
8c3d48c5cd
8 changed files with 364 additions and 60 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue