mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 13:39:41 +02:00
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:
@@ -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' }] };
|
||||
|
||||
Reference in New Issue
Block a user