mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
fix(tui): handle split Shift+Enter in VS Code
This commit is contained in:
parent
f0fd0a7d6a
commit
178a3a563f
4 changed files with 84 additions and 0 deletions
|
|
@ -232,6 +232,7 @@ export class Editor implements Component {
|
|||
// Bracketed paste mode buffering
|
||||
private pasteBuffer: string = "";
|
||||
private isInPaste: boolean = false;
|
||||
private pendingShiftEnter: boolean = false;
|
||||
|
||||
// Prompt history for up/down navigation
|
||||
private history: string[] = [];
|
||||
|
|
@ -422,6 +423,21 @@ export class Editor implements Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.pendingShiftEnter) {
|
||||
if (data === "\r") {
|
||||
this.pendingShiftEnter = false;
|
||||
this.addNewLine();
|
||||
return;
|
||||
}
|
||||
this.pendingShiftEnter = false;
|
||||
this.insertCharacter("\\");
|
||||
}
|
||||
|
||||
if (data === "\\") {
|
||||
this.pendingShiftEnter = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Ctrl+C - let parent handle (exit/clear)
|
||||
if (kb.matches(data, "copy")) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export class Input implements Component {
|
|||
// Bracketed paste mode buffering
|
||||
private pasteBuffer: string = "";
|
||||
private isInPaste: boolean = false;
|
||||
private pendingShiftEnter: boolean = false;
|
||||
|
||||
getValue(): string {
|
||||
return this.value;
|
||||
|
|
@ -63,6 +64,23 @@ export class Input implements Component {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pendingShiftEnter) {
|
||||
if (data === "\r") {
|
||||
this.pendingShiftEnter = false;
|
||||
if (this.onSubmit) this.onSubmit(this.value);
|
||||
return;
|
||||
}
|
||||
this.pendingShiftEnter = false;
|
||||
this.value = `${this.value.slice(0, this.cursor)}\\${this.value.slice(this.cursor)}`;
|
||||
this.cursor += 1;
|
||||
}
|
||||
|
||||
if (data === "\\") {
|
||||
this.pendingShiftEnter = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const kb = getEditorKeybindings();
|
||||
|
||||
// Escape/Cancel
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue