wormclaude 1.0.133 → 1.0.134
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/theme.js +1 -1
- package/dist/tui.js +30 -12
- package/package.json +1 -1
package/dist/theme.js
CHANGED
package/dist/tui.js
CHANGED
|
@@ -96,25 +96,30 @@ export async function runTui() {
|
|
|
96
96
|
const inner = Math.max(4, W - 2); // "✶ " önek payı
|
|
97
97
|
const REV = '\x1b[7m', UNREV = '\x1b[27m'; // ters-video blok imleç
|
|
98
98
|
// Karakterleri hücreye çevir; imleçteki karakter ters-video (sondaysa boşluk bloğu).
|
|
99
|
-
|
|
100
|
-
const chs = [...inputBuf];
|
|
101
|
-
for (let i = 0; i < chs.length; i++) {
|
|
102
|
-
cells.push({ s: i === inputCur ? REV + chs[i] + UNREV : chs[i], w: stringWidth(chs[i]) || 1 });
|
|
103
|
-
}
|
|
104
|
-
if (inputCur >= chs.length)
|
|
105
|
-
cells.push({ s: REV + ' ' + UNREV, w: 1 });
|
|
106
|
-
// Genişliğe göre sar.
|
|
99
|
+
// Karakterleri genişliğe göre sar; YAPIŞTIRILAN newline (\n) = sert satır kırma.
|
|
107
100
|
const wrapped = [];
|
|
101
|
+
const chs = [...inputBuf];
|
|
108
102
|
let cur = '', w = 0;
|
|
109
|
-
for (
|
|
110
|
-
if (
|
|
103
|
+
for (let i = 0; i < chs.length; i++) {
|
|
104
|
+
if (chs[i] === '\n') { // çok-satır yapıştırma satır sonu
|
|
105
|
+
if (i === inputCur)
|
|
106
|
+
cur += REV + ' ' + UNREV;
|
|
111
107
|
wrapped.push(cur);
|
|
112
108
|
cur = '';
|
|
113
109
|
w = 0;
|
|
110
|
+
continue;
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
w
|
|
112
|
+
const cw = stringWidth(chs[i]) || 1;
|
|
113
|
+
if (w + cw > inner) {
|
|
114
|
+
wrapped.push(cur);
|
|
115
|
+
cur = '';
|
|
116
|
+
w = 0;
|
|
117
|
+
}
|
|
118
|
+
cur += (i === inputCur ? REV + chs[i] + UNREV : chs[i]);
|
|
119
|
+
w += cw;
|
|
117
120
|
}
|
|
121
|
+
if (inputCur >= chs.length)
|
|
122
|
+
cur += REV + ' ' + UNREV;
|
|
118
123
|
wrapped.push(cur);
|
|
119
124
|
if (wrapped.length <= MAX_INPUT_LINES) {
|
|
120
125
|
return wrapped.map((ln, i) => (i === 0 ? paint('✶ ', theme.redBright, true) : ' ') + paint(ln, theme.white));
|
|
@@ -479,7 +484,11 @@ export async function runTui() {
|
|
|
479
484
|
}
|
|
480
485
|
catch { } });
|
|
481
486
|
let ctrlcAt = 0;
|
|
487
|
+
let lastKeyTs = 0; // yapıştırma tespiti: ardışık keypress'ler aynı anda (<8ms) gelir = paste
|
|
482
488
|
process.stdin.on('keypress', (str, key) => {
|
|
489
|
+
const _kt = Date.now();
|
|
490
|
+
const _burst = _kt - lastKeyTs < 8;
|
|
491
|
+
lastKeyTs = _kt;
|
|
483
492
|
// Soru dialogu (AskUserQuestion) aktifse: ↑↓ / 1-9 seç, Enter onayla, Esc/Ctrl+C ilk seçenek
|
|
484
493
|
if (ask) {
|
|
485
494
|
const n = ask.options.length;
|
|
@@ -629,6 +638,15 @@ export async function runTui() {
|
|
|
629
638
|
return;
|
|
630
639
|
}
|
|
631
640
|
if (key && key.name === 'return') {
|
|
641
|
+
// YAPIŞTIRMA: newline bir burst (paste) içinde geldiyse submit DEĞİL, satır sonu olarak ekle.
|
|
642
|
+
// Böylece çok-satırlı metni tek seferde yapıştırıp tamamını input'ta tutabiliriz.
|
|
643
|
+
if (_burst && inputBuf) {
|
|
644
|
+
inputBuf = inputBuf.slice(0, inputCur) + '\n' + inputBuf.slice(inputCur);
|
|
645
|
+
inputCur++;
|
|
646
|
+
cmdSel = 0;
|
|
647
|
+
scheduleFooter();
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
632
650
|
if (busy)
|
|
633
651
|
return; // tur sürerken Enter beklemede; yazılan metin durur (type-ahead)
|
|
634
652
|
let v = inputBuf.trim();
|