mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-10 04:27:45 -05:00
input: add new Unicode input mode
This mode is activated through the new key-bindings.unicode-input and search-bindings.unicode-input key bindings. When active, the user can “build” a Unicode codepoint by typing its hexadecimal value. Note that there’s no visual feedback in this mode. This is intentional. This mode is intended to be a fallback for users that don’t use an IME. Closes #1116
This commit is contained in:
parent
fa2d9f8699
commit
8967dd9cfe
11 changed files with 167 additions and 2 deletions
38
unicode-mode.c
Normal file
38
unicode-mode.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include "unicode-mode.h"
|
||||
|
||||
#include "render.h"
|
||||
|
||||
void
|
||||
unicode_mode_activate(struct seat *seat)
|
||||
{
|
||||
if (seat->unicode_mode.active)
|
||||
return;
|
||||
|
||||
seat->unicode_mode.active = true;
|
||||
seat->unicode_mode.character = u'\0';
|
||||
seat->unicode_mode.count = 0;
|
||||
unicode_mode_updated(seat);
|
||||
}
|
||||
|
||||
void
|
||||
unicode_mode_deactivate(struct seat *seat)
|
||||
{
|
||||
if (!seat->unicode_mode.active)
|
||||
return;
|
||||
|
||||
seat->unicode_mode.active = false;
|
||||
unicode_mode_updated(seat);
|
||||
}
|
||||
|
||||
void
|
||||
unicode_mode_updated(struct seat *seat)
|
||||
{
|
||||
struct terminal *term = seat->kbd_focus;
|
||||
if (term == NULL)
|
||||
return;
|
||||
|
||||
if (term->is_searching)
|
||||
render_refresh_search(term);
|
||||
else
|
||||
render_refresh(term);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue