From 47e82cd5d2af948be57b71bfa5f5d5b3fce6a22e Mon Sep 17 00:00:00 2001 From: Nathan Bourgeois Date: Mon, 4 May 2026 11:36:56 -0400 Subject: [PATCH] Fix detection of Shift + Enter in integrated terminal --- src/input/keyboard.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/input/keyboard.zig b/src/input/keyboard.zig index 246bd28..f59c19c 100644 --- a/src/input/keyboard.zig +++ b/src/input/keyboard.zig @@ -83,7 +83,14 @@ fn parseControl(c: u8) KeyEvent { return switch (c) { 0 => .{ .key = .null_key, .modifiers = .{ .ctrl = true } }, 9 => .{ .key = .tab }, - 10, 13 => .{ .key = .enter }, + // In raw mode 0x0a is sent by the terminal itself + // Some editor-integrated terminals (Zed, possibly VSCode) use this + // historical CR/LF split to encode Shift+Enter without a richer + // keyboard protocol -- plain Enter sends 0x0d, Shift+Enter sends + // 0x0a. Mapping LF onto Enter+Shift recovers the modifier, ensuring + // consistent behavior to other TUI applications / libraries. + 10 => .{ .key = .enter, .modifiers = .{ .shift = true } }, + 13 => .{ .key = .enter }, 27 => .{ .key = .escape }, 1...8, 11, 12, 14...26 => .{ .key = .{ .char = 'a' + c - 1 },