feat(coding-agent): clipboard image paste support via Ctrl+V (fixes #419)

This commit is contained in:
Mario Zechner 2026-01-04 01:05:22 +01:00
parent 97bb411988
commit 5c5084481b
8 changed files with 233 additions and 2 deletions

View file

@ -408,7 +408,9 @@ export class Editor implements Component {
const endIndex = this.pasteBuffer.indexOf("\x1b[201~");
if (endIndex !== -1) {
const pasteContent = this.pasteBuffer.substring(0, endIndex);
this.handlePaste(pasteContent);
if (pasteContent.length > 0) {
this.handlePaste(pasteContent);
}
this.isInPaste = false;
const remaining = this.pasteBuffer.substring(endIndex + 6);
this.pasteBuffer = "";
@ -707,6 +709,16 @@ export class Editor implements Component {
this.setTextInternal(text);
}
/**
* Insert text at the current cursor position.
* Used for programmatic insertion (e.g., clipboard image markers).
*/
insertTextAtCursor(text: string): void {
for (const char of text) {
this.insertCharacter(char);
}
}
// All the editor methods from before...
private insertCharacter(char: string): void {
this.historyIndex = -1; // Exit history browsing mode