From 59bb331d5e702a4cb608636d4b8b534a3903f7bb Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sun, 21 Feb 2021 20:57:02 +0100 Subject: [PATCH] Fix intermediate reset when going from DCS to ESC This resolves a bug when transitioning between DCS and ESC sequences, which would cause the intermediates of the ESC dispatch to contain data from the DCS sequence. --- src/lib.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b6d2658..9d7931f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,28 +165,26 @@ impl Parser { match self.state { State::DcsPassthrough => { self.perform_action(performer, Action::Unhook, byte); - maybe_action!(action, byte); }, State::OscString => { self.perform_action(performer, Action::OscEnd, byte); - maybe_action!(action, byte); }, - _ => { - maybe_action!(action, byte); - - match state { - State::CsiEntry | State::DcsEntry | State::Escape => { - self.perform_action(performer, Action::Clear, byte); - }, - State::DcsPassthrough => { - self.perform_action(performer, Action::Hook, byte); - }, - State::OscString => { - self.perform_action(performer, Action::OscStart, byte); - }, - _ => (), - } + _ => (), + } + + maybe_action!(action, byte); + + match state { + State::CsiEntry | State::DcsEntry | State::Escape => { + self.perform_action(performer, Action::Clear, byte); + }, + State::DcsPassthrough => { + self.perform_action(performer, Action::Hook, byte); + }, + State::OscString => { + self.perform_action(performer, Action::OscStart, byte); }, + _ => (), } // Assume the new state