codemaxxing 1.0.6 → 1.0.8
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/index.js +6 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1760,10 +1760,10 @@ let burstTimer = null;
|
|
|
1760
1760
|
const BURST_WINDOW_MS = 50; // Long enough for slow terminals to finish delivering paste
|
|
1761
1761
|
// Debug paste: set CODEMAXXING_DEBUG_PASTE=1 to log all stdin chunks to /tmp/codemaxxing-paste-debug.log
|
|
1762
1762
|
const PASTE_DEBUG = process.env.CODEMAXXING_DEBUG_PASTE === "1";
|
|
1763
|
-
import { appendFileSync } from "node:fs";
|
|
1764
1763
|
function pasteLog(msg) {
|
|
1765
1764
|
if (!PASTE_DEBUG)
|
|
1766
1765
|
return;
|
|
1766
|
+
const { appendFileSync } = require("node:fs");
|
|
1767
1767
|
const escaped = msg.replace(/\x1b/g, "\\x1b").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
1768
1768
|
try {
|
|
1769
1769
|
appendFileSync("/tmp/codemaxxing-paste-debug.log", `[${Date.now()}] ${escaped}\n`);
|
|
@@ -1772,7 +1772,7 @@ function pasteLog(msg) {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
const origEmit = process.stdin.emit.bind(process.stdin);
|
|
1774
1774
|
function handlePasteContent(content) {
|
|
1775
|
-
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
1775
|
+
const normalized = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
|
1776
1776
|
if (!normalized)
|
|
1777
1777
|
return;
|
|
1778
1778
|
const lineCount = normalized.split("\n").length;
|
|
@@ -1789,8 +1789,10 @@ function handlePasteContent(content) {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
function looksLikeMultilinePaste(data) {
|
|
1791
1791
|
const clean = data.replace(/\x1b\[[0-9;]*[A-Za-z]/g, ""); // Strip all ANSI escapes
|
|
1792
|
-
|
|
1793
|
-
const
|
|
1792
|
+
// Count \r\n, \n, and bare \r as line breaks (macOS terminals often use bare \r)
|
|
1793
|
+
const normalized = clean.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
1794
|
+
const newlines = (normalized.match(/\n/g) ?? []).length;
|
|
1795
|
+
const printable = normalized.replace(/\n/g, "").trim().length;
|
|
1794
1796
|
return newlines >= 2 || (newlines >= 1 && printable >= 40);
|
|
1795
1797
|
}
|
|
1796
1798
|
function flushBurst() {
|