@@ -56,7 +56,7 @@ pub fn to_esc_str(
("tab", AlacModifiers::None) => Some("\x09"),
("escape", AlacModifiers::None) => Some("\x1b"),
("enter", AlacModifiers::None) => Some("\x0d"),
- ("enter", AlacModifiers::Shift) => Some("\x0d"),
+ ("enter", AlacModifiers::Shift) => Some("\x0a"),
("enter", AlacModifiers::Alt) => Some("\x1b\x0d"),
("backspace", AlacModifiers::None) => Some("\x7f"),
//Interesting escape codes
@@ -406,6 +406,22 @@ mod test {
}
}
+ #[test]
+ fn test_shift_enter_newline() {
+ let shift_enter = Keystroke::parse("shift-enter").unwrap();
+ let regular_enter = Keystroke::parse("enter").unwrap();
+ let mode = TermMode::NONE;
+
+ // Shift-enter should send line feed (newline)
+ assert_eq!(to_esc_str(&shift_enter, &mode, false), Some("\x0a".into()));
+
+ // Regular enter should still send carriage return
+ assert_eq!(
+ to_esc_str(®ular_enter, &mode, false),
+ Some("\x0d".into())
+ );
+ }
+
#[test]
fn test_modifier_code_calc() {
// Code Modifiers