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 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-08-22 14:13:57 +02:00
parent 6ef3b2ba2e
commit 0566ea3453
+2
View File
@@ -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' }] };