From bb74d8155e3e8b834ecb32fe52333e0ea9c942e7 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 29 May 2026 14:55:50 +0800 Subject: [PATCH] Decode f1-f5 on Linux console Other things like shift-f1 are not supported on console yet because Linux sends "CSI 25 ~" which means shift-f3 in urxvt, so there's a conflict. Closes #12787 --- src/input_common.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index c3a621fa1..218dec159 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -1008,12 +1008,28 @@ fn parse_csi(&mut self, buffer: &mut Vec) -> Option { }; let mut next_char = |zelf: &mut Self| zelf.read_sequence_byte(buffer).unwrap_or(0xff); let private_mode; - if matches!(c, b'?' | b'<' | b'=' | b'>') { - // private mode - private_mode = Some(c); - c = next_char(self); - } else { - private_mode = None; + match c { + b'[' => { + // Illegal CSI command. + return Some(KeyEvent::new( + Modifiers::default(), + function_key(match next_char(self) { + b'A' => 1, + b'B' => 2, + b'C' => 3, + b'D' => 4, + b'E' => 5, + _ => return invalid_sequence(buffer), + }), + )); + } + b'?' | b'<' | b'=' | b'>' => { + private_mode = Some(c); + c = next_char(self); + } + _ => { + private_mode = None; + } } let mut count = 0; let mut subcount = 0;