From 0566ea3453c57bab1d972fde584024ffabd0a781 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Sun, 16 Aug 2026 19:06:56 +0200 Subject: [PATCH] docs: record why the key parser reads LF as Enter Ctrl+J is unbindable as a result, which is worth knowing before someone tries to bind it. Co-Authored-By: Claude Fable 5 --- src/tui/tui-keys.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tui/tui-keys.ts b/src/tui/tui-keys.ts index fb476e3a..2435f0c4 100644 --- a/src/tui/tui-keys.ts +++ b/src/tui/tui-keys.ts @@ -162,6 +162,8 @@ export function createKeyParser(): TuiKeyParser { /** Parse one non-escape byte (or one UTF-8 character) off the front. */ const parseByte = (): ParseStep => { const b = buf[0]; + // LF counts as Enter because some terminals send it for Return; the cost is + // that Ctrl+J is not bindable, which no key in the plan's keymap wants. if (b === 0x0d || b === 0x0a) return { consumed: 1, events: [{ type: 'enter' }] }; if (b === 0x09) return { consumed: 1, events: [{ type: 'tab' }] }; if (b === 0x7f || b === 0x08) return { consumed: 1, events: [{ type: 'backspace' }] };