micro-models-agent 0.36.2 → 0.36.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +43 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -30109,6 +30109,8 @@ class LineEditor {
|
|
|
30109
30109
|
stash = null;
|
|
30110
30110
|
isDone = false;
|
|
30111
30111
|
isPaste = false;
|
|
30112
|
+
pasteBuffer = "";
|
|
30113
|
+
pasteLastWasCR = false;
|
|
30112
30114
|
lastWasCR = false;
|
|
30113
30115
|
questionCb = null;
|
|
30114
30116
|
rawMode = false;
|
|
@@ -30235,22 +30237,38 @@ class LineEditor {
|
|
|
30235
30237
|
}
|
|
30236
30238
|
if (name === "paste-start" || seq2 === "\x1B[200~") {
|
|
30237
30239
|
this.isPaste = true;
|
|
30240
|
+
this.pasteBuffer = "";
|
|
30241
|
+
this.pasteLastWasCR = false;
|
|
30238
30242
|
return;
|
|
30239
30243
|
}
|
|
30240
30244
|
if (name === "paste-end" || seq2 === "\x1B[201~") {
|
|
30241
30245
|
this.isPaste = false;
|
|
30242
|
-
this.
|
|
30246
|
+
if (this.pasteBuffer) {
|
|
30247
|
+
this.insertPaste(this.pasteBuffer);
|
|
30248
|
+
} else {
|
|
30249
|
+
this.render();
|
|
30250
|
+
}
|
|
30251
|
+
this.pasteBuffer = "";
|
|
30252
|
+
this.pasteLastWasCR = false;
|
|
30243
30253
|
return;
|
|
30244
30254
|
}
|
|
30245
30255
|
if (this.isPaste) {
|
|
30246
|
-
if (name === "return" || seq2 === "\r"
|
|
30256
|
+
if (name === "return" || seq2 === "\r") {
|
|
30257
|
+
this.pasteBuffer += `
|
|
30258
|
+
`;
|
|
30259
|
+
this.pasteLastWasCR = true;
|
|
30260
|
+
} else if (name === "enter" || seq2 === `
|
|
30247
30261
|
`) {
|
|
30248
|
-
this.
|
|
30249
|
-
|
|
30262
|
+
if (this.pasteLastWasCR) {
|
|
30263
|
+
this.pasteLastWasCR = false;
|
|
30264
|
+
} else {
|
|
30265
|
+
this.pasteBuffer += `
|
|
30266
|
+
`;
|
|
30267
|
+
}
|
|
30250
30268
|
} else if (str) {
|
|
30251
|
-
this.
|
|
30269
|
+
this.pasteLastWasCR = false;
|
|
30270
|
+
this.pasteBuffer += str;
|
|
30252
30271
|
}
|
|
30253
|
-
this.render();
|
|
30254
30272
|
return;
|
|
30255
30273
|
}
|
|
30256
30274
|
if (name === "return" && (seq2 === "\x1B\r" || k.meta)) {
|
|
@@ -30455,6 +30473,25 @@ class LineEditor {
|
|
|
30455
30473
|
this.col += t2.length;
|
|
30456
30474
|
this.render();
|
|
30457
30475
|
}
|
|
30476
|
+
insertPaste(text) {
|
|
30477
|
+
const segments = text.split(`
|
|
30478
|
+
`);
|
|
30479
|
+
if (segments.length === 1) {
|
|
30480
|
+
this.insertText(segments[0]);
|
|
30481
|
+
return;
|
|
30482
|
+
}
|
|
30483
|
+
const chars = this.currentChars();
|
|
30484
|
+
const head = chars.slice(0, this.col).join("");
|
|
30485
|
+
const tail = chars.slice(this.col).join("");
|
|
30486
|
+
const lines = [head + segments[0]];
|
|
30487
|
+
for (let i = 1;i < segments.length - 1; i++)
|
|
30488
|
+
lines.push(segments[i]);
|
|
30489
|
+
lines.push(segments[segments.length - 1] + tail);
|
|
30490
|
+
this.lines.splice(this.row, 1, ...lines);
|
|
30491
|
+
this.row += segments.length - 1;
|
|
30492
|
+
this.col = charLen(segments[segments.length - 1]);
|
|
30493
|
+
this.render();
|
|
30494
|
+
}
|
|
30458
30495
|
insertNewline() {
|
|
30459
30496
|
const chars = this.currentChars();
|
|
30460
30497
|
const rest = chars.slice(this.col).join("");
|