summaryrefslogtreecommitdiff
path: root/src/input/parse.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 15:48:58 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 15:48:58 +0300
commited0c051c55e40c1ab3cdc029ba4ca518ee407a1e (patch)
tree3c515192394da2caaca2c63eb93152ed308841b8 /src/input/parse.rs
parent0276da6f2a44da493d1c198bcc6b5a8b1d2fda44 (diff)
fix: preserve lf in raw terminal input
Diffstat (limited to 'src/input/parse.rs')
-rw-r--r--src/input/parse.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/input/parse.rs b/src/input/parse.rs
index 525119f4..b7b449ae 100644
--- a/src/input/parse.rs
+++ b/src/input/parse.rs
@@ -61,7 +61,10 @@ fn parse_legacy_key_sequence(data: &str) -> Option<TerminalKey> {
}
match data {
- "\r" | "\n" => Some(TerminalKey::new(KeyCode::Enter, KeyModifiers::empty())),
+ // In raw mode, Enter is carriage return. A bare line feed is ambiguous in
+ // terminal input and is commonly used for Ctrl+J or Shift+Enter workarounds.
+ // Preserve LF by letting it fall through to legacy control-byte parsing.
+ "\r" => Some(TerminalKey::new(KeyCode::Enter, KeyModifiers::empty())),
"\t" => Some(TerminalKey::new(KeyCode::Tab, KeyModifiers::empty())),
"\x1b" => Some(TerminalKey::new(KeyCode::Esc, KeyModifiers::empty())),
"\x7f" => Some(TerminalKey::new(KeyCode::Backspace, KeyModifiers::empty())),