mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 11:02:17 +00:00
fix(tui): use isBackspace and isEnter helpers in Editor
Fixes Backspace and Enter not working with Caps Lock enabled. The Kitty protocol sends lock key bits in modifiers which broke the raw byte detection.
This commit is contained in:
parent
cbd20b58a6
commit
84eaad8029
1 changed files with 4 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ import {
|
|||
isArrowLeft,
|
||||
isArrowRight,
|
||||
isArrowUp,
|
||||
isBackspace,
|
||||
isCtrlA,
|
||||
isCtrlC,
|
||||
isCtrlE,
|
||||
|
|
@ -421,8 +422,8 @@ export class Editor implements Component {
|
|||
// Modifier + Enter = new line
|
||||
this.addNewLine();
|
||||
}
|
||||
// Plain Enter (char code 13 for CR) - only CR submits, LF adds new line
|
||||
else if (data.charCodeAt(0) === 13 && data.length === 1) {
|
||||
// Plain Enter - submit (handles both legacy \r and Kitty protocol with lock bits)
|
||||
else if (isEnter(data)) {
|
||||
// If submit is disabled, do nothing
|
||||
if (this.disableSubmit) {
|
||||
return;
|
||||
|
|
@ -458,7 +459,7 @@ export class Editor implements Component {
|
|||
}
|
||||
}
|
||||
// Backspace
|
||||
else if (data.charCodeAt(0) === 127 || data.charCodeAt(0) === 8) {
|
||||
else if (isBackspace(data)) {
|
||||
this.handleBackspace();
|
||||
}
|
||||
// Line navigation shortcuts (Home/End keys)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue