sapper-iq 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sapper-ui.mjs +14 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "AI-powered development assistant that executes commands and builds projects",
5
5
  "main": "sapper.mjs",
6
6
  "bin": {
package/sapper-ui.mjs CHANGED
@@ -1806,14 +1806,21 @@ function sendPasteToTerm(text) {
1806
1806
  showToast('Terminal not connected', 'err');
1807
1807
  return false;
1808
1808
  }
1809
- // xterm bracketed-paste sequence + Enter
1810
- var BEGIN = '\\u001b[200~';
1811
- var END = '\\u001b[201~';
1812
- // Decode escape literals; pty sees raw bytes
1813
- ws.send('\\u001b[200~'); // ESC [ 200 ~ (start paste)
1809
+ // Sapper's readline does NOT advertise bracketed-paste mode (no ESC[?2004h),
1810
+ // so wrapping in ESC[200~ … ESC[201~ would leak the literal "^[[200~" into
1811
+ // the prompt. Only use bracket-paste when we truly need multi-line atomicity
1812
+ // (Ask AI feature). For single-line content, send it raw and submit with \\r.
1813
+ var LF = String.fromCharCode(10);
1814
+ var CR = String.fromCharCode(13);
1815
+ if (text.indexOf(LF) < 0 && text.indexOf(CR) < 0) {
1816
+ ws.send(text + CR);
1817
+ return true;
1818
+ }
1819
+ // Multi-line: bracketed paste so readline treats it as one input.
1820
+ ws.send('\\u001b[200~');
1814
1821
  ws.send(text);
1815
- ws.send('\\u001b[201~'); // end paste
1816
- ws.send('\\r');
1822
+ ws.send('\\u001b[201~');
1823
+ ws.send(CR);
1817
1824
  return true;
1818
1825
  }
1819
1826