unicode: introduce kmscon_utf8_mach_reset()
Sometimes we need to reset the UTF8 state-machine, for instance when resetting the VTE. This function simply resets the internal state to KMSCON_UTF8_START so we start all over on the next input character. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
f6a39baf39
commit
277edee2dc
@ -421,3 +421,11 @@ uint32_t kmscon_utf8_mach_get(struct kmscon_utf8_mach *mach)
|
||||
|
||||
return mach->ch;
|
||||
}
|
||||
|
||||
void kmscon_utf8_mach_reset(struct kmscon_utf8_mach *mach)
|
||||
{
|
||||
if (!mach)
|
||||
return;
|
||||
|
||||
mach->state = KMSCON_UTF8_START;
|
||||
}
|
||||
|
@ -81,5 +81,6 @@ void kmscon_utf8_mach_free(struct kmscon_utf8_mach *mach);
|
||||
|
||||
int kmscon_utf8_mach_feed(struct kmscon_utf8_mach *mach, char c);
|
||||
uint32_t kmscon_utf8_mach_get(struct kmscon_utf8_mach *mach);
|
||||
void kmscon_utf8_mach_reset(struct kmscon_utf8_mach *mach);
|
||||
|
||||
#endif /* KMSCON_UNICODE_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user