Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/edit/src/vt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ impl<'input> Stream<'_, 'input> {
'P' => {
self.parser.state = State::Dcs;
}
'\x1b' => {
// Per VT100, a new ESC cancels the escape sequence in progress
// and stays in the Esc state so whatever follows (e.g. `[A`)
// is still parsed as a sequence instead of leaking as text.
}
Comment on lines +208 to +212

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not believe this is correct.

VT100:

This state is entered whenever the C0 control ESC is received. This will immediately cancel any escape sequence, control sequence or control string in progress. If an escape sequence or control sequence was in progress, “cancel” means that the sequence will have no effect

xterm's altSendsEscape and metaSendsEscape do not countermand this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense, thanks for catching that! Updated it to just cancel the previous ESC and stay in State::Esc per VT100 instead of emitting Esc('\0'), so whatever follows still gets parsed as a sequence instead of leaking as text. Really appreciate the review!

c => {
self.parser.state = State::Ground;
return Some(Token::Esc(c));
Expand Down