codemaxxing 1.0.4 → 1.0.5

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/dist/index.js +11 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1757,7 +1757,7 @@ let bracketedBuffer = "";
1757
1757
  let inBracketedPaste = false;
1758
1758
  let burstBuffer = "";
1759
1759
  let burstTimer = null;
1760
- const BURST_WINDOW_MS = 25; // Short enough to feel instant, long enough to catch paste bursts
1760
+ const BURST_WINDOW_MS = 50; // Long enough for slow terminals to finish delivering paste
1761
1761
  const origEmit = process.stdin.emit.bind(process.stdin);
1762
1762
  function handlePasteContent(content) {
1763
1763
  const normalized = content.replace(/\r\n/g, "\n").trim();
@@ -1801,10 +1801,16 @@ process.stdin.emit = function (event, ...args) {
1801
1801
  }
1802
1802
  const chunk = args[0];
1803
1803
  let data = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf-8") : String(chunk);
1804
+ // Aggressively strip ALL bracketed paste escape sequences from every chunk,
1805
+ // regardless of context. Some terminals split markers across chunks or send
1806
+ // them in unexpected positions. We never want \x1b[200~ or \x1b[201~ (or
1807
+ // partial fragments like [200~ / [201~) to reach the input component.
1808
+ const hadStart = data.includes("\x1b[200~") || data.includes("[200~");
1809
+ const hadEnd = data.includes("\x1b[201~") || data.includes("[201~");
1810
+ // Strip full and partial bracketed paste markers
1811
+ data = data.replace(/\x1b?\[20[01]~/g, "");
1804
1812
  // ── Bracketed paste handling ──
1805
- const hasStart = data.includes("\x1b[200~");
1806
- const hasEnd = data.includes("\x1b[201~");
1807
- if (hasStart) {
1813
+ if (hadStart) {
1808
1814
  // Flush any pending burst before entering bracketed mode
1809
1815
  if (burstTimer) {
1810
1816
  clearTimeout(burstTimer);
@@ -1812,10 +1818,8 @@ process.stdin.emit = function (event, ...args) {
1812
1818
  }
1813
1819
  flushBurst();
1814
1820
  inBracketedPaste = true;
1815
- data = data.replace(/\x1b\[200~/g, "");
1816
1821
  }
1817
- if (hasEnd) {
1818
- data = data.replace(/\x1b\[201~/g, "");
1822
+ if (hadEnd) {
1819
1823
  bracketedBuffer += data;
1820
1824
  inBracketedPaste = false;
1821
1825
  const content = bracketedBuffer;
@@ -1828,8 +1832,6 @@ process.stdin.emit = function (event, ...args) {
1828
1832
  return true;
1829
1833
  }
1830
1834
  // ── Burst buffering for non-bracketed paste ──
1831
- // Strip stray bracketed paste markers that might appear outside a proper pair
1832
- data = data.replace(/\x1b\[20[01]~/g, "");
1833
1835
  burstBuffer += data;
1834
1836
  if (burstTimer)
1835
1837
  clearTimeout(burstTimer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemaxxing",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Open-source terminal coding agent. Connect any LLM. Max your code.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {