Skip to content

Commit

Permalink
Fix intermediate reset when going from DCS to ESC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chrisduerr committed Feb 21, 2021
1 parent 8a0c57b commit 59bb331
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 59bb331

Please sign in to comment.