input decoding: fix parsing of CSI/SS3 sequences prefixed with legacy alt

Commit af137e5e96 (scrollback-push to query for indn/cuu via XTGETTCAP,
2025-01-05) extracted a bool variable

	recursive_invocation = buffer.len() == 2

It replaced another instance of "buffer.len() == 2" with that variable,
but that's wrong because buffer has grown since then (so it's either
2 or 3).  Flip the bool to fix this.

While at it, tighten an assertion.
This commit is contained in:
Johannes Altmanninger
2026-06-05 17:53:18 +08:00
parent 800d8a5728
commit 943300c572

View File

@@ -133,13 +133,13 @@ fn parse_escape_sequence(
buffer: &mut Vec<u8>,
have_escape_prefix: &mut bool,
) -> Option<KeyEvent> {
assert!(buffer.len() <= 2);
assert!(matches!(buffer.as_slice(), b"\x1b" | b"\x1b\x1b"));
let recursive_invocation = buffer.len() == 2;
let Some(next) = self.read_sequence_byte(buffer) else {
return Some(KeyEvent::from_raw(key::ESCAPE));
};
let invalid = KeyEvent::from_raw(key::INVALID);
if recursive_invocation && next == b'\x1b' {
if !recursive_invocation && next == b'\x1b' {
return Some(
match self.parse_escape_sequence(buffer, have_escape_prefix) {
Some(mut nested_sequence) => {