vte: add kmscon_vte_reset()

This performs a soft reset of the VTE state machine. It does not affect
the console that is bound to the VTE, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-05-29 12:16:18 +02:00
parent 64e235bc22
commit 5c67c969bf
2 changed files with 27 additions and 0 deletions

View File

@ -237,6 +237,32 @@ static void vte_write_debug(struct kmscon_vte *vte, const char *u8, size_t len,
#define vte_write_raw(_vte, _u8, _len) \
vte_write_debug((_vte), (_u8), (_len), true, __FILE__, __LINE__)
/*
* Reset VTE state
* This performs a soft reset of the VTE. That is, everything is reset to the
* same state as when the VTE was created. This does not affect the console,
* though.
*/
void kmscon_vte_reset(struct kmscon_vte *vte)
{
if (!vte)
return;
vte->flags = 0;
kmscon_utf8_mach_reset(vte->mach);
vte->state = STATE_GROUND;
vte->cattr.fr = 255;
vte->cattr.fg = 255;
vte->cattr.fb = 255;
vte->cattr.br = 0;
vte->cattr.bg = 0;
vte->cattr.bb = 0;
vte->cattr.bold = 0;
vte->cattr.underline = 0;
vte->cattr.inverse = 0;
}
/* execute control character (C0 or C1) */
static void do_execute(struct kmscon_vte *vte, uint32_t ctrl)
{

View File

@ -65,6 +65,7 @@ int kmscon_vte_new(struct kmscon_vte **out, struct kmscon_console *con,
void kmscon_vte_ref(struct kmscon_vte *vte);
void kmscon_vte_unref(struct kmscon_vte *vte);
void kmscon_vte_reset(struct kmscon_vte *vte);
void kmscon_vte_input(struct kmscon_vte *vte, const char *u8, size_t len);
void kmscon_vte_handle_keyboard(struct kmscon_vte *vte,
const struct uterm_input_event *ev);