diff --git a/src/vte.c b/src/vte.c index 7dbb965..d79ab83 100644 --- a/src/vte.c +++ b/src/vte.c @@ -576,8 +576,9 @@ static void csi_soft_reset(struct kmscon_vte *vte) static void csi_compat_mode(struct kmscon_vte *vte) { - /* DECSCL: Compatibility Level */ - /* Sometimes CSI_DQUOTE is set here, too */ + /* always perform soft reset */ + csi_soft_reset(vte); + if (vte->csi_argv[0] == 61) { /* Switching to VT100 compatibility mode. We do * not support this mode, so ignore it. In fact, @@ -586,7 +587,6 @@ static void csi_compat_mode(struct kmscon_vte *vte) * However, we enable 7bit mode to avoid * character-table problems */ vte->flags |= FLAG_7BIT_MODE; - kmscon_utf8_mach_reset(vte->mach); vte->gl = &kmscon_vte_unicode_lower; vte->gr = &kmscon_vte_dec_supplemental_graphics; } else if (vte->csi_argv[0] == 62 || @@ -607,23 +607,11 @@ static void csi_compat_mode(struct kmscon_vte *vte) log_debug("client requests 8bit controls which we do not support as output"); vte->flags |= FLAG_8BIT_MODE; - vte->flags &= ~FLAG_7BIT_MODE; - kmscon_utf8_mach_reset(vte->mach); vte->gl = &kmscon_vte_unicode_lower; vte->gr = &kmscon_vte_dec_supplemental_graphics; } else { - /* When any other compatibility mode is - * selected, we explicitely switch to UTF8 mode - * again so you can use this as special kmscon - * command to switch out of compatibility modes - * and avoiding a soft-reset. */ log_debug("unhandled DECSCL 'p' CSI %i, switching to utf-8 mode again", vte->csi_argv[0]); - - vte->flags &= ~(FLAG_8BIT_MODE | FLAG_7BIT_MODE); - kmscon_utf8_mach_reset(vte->mach); - vte->gl = &kmscon_vte_unicode_lower; - vte->gr = &kmscon_vte_unicode_upper; } } @@ -687,6 +675,7 @@ static void do_csi(struct kmscon_vte *vte, uint32_t data) case 'p': if (vte->csi_flags & CSI_GT) { /* xterm: select X11 visual cursor mode */ + csi_soft_reset(vte); } else if (vte->csi_flags & CSI_BANG) { /* DECSTR: Soft Reset */ csi_soft_reset(vte); @@ -694,7 +683,10 @@ static void do_csi(struct kmscon_vte *vte, uint32_t data) /* DECRQM: Request DEC Private Mode */ /* If CSI_WHAT is set, then enable, * otherwise disable */ + csi_soft_reset(vte); } else { + /* DECSCL: Compatibility Level */ + /* Sometimes CSI_DQUOTE is set here, too */ csi_compat_mode(vte); } break;