@zhongqian97-code/ecode 0.5.6 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1910,11 +1910,18 @@ var Input = forwardRef(function Input2({ isActive, onSubmit, onChange, placehold
1910
1910
  }
1911
1911
  const before = line.slice(0, cursorCol);
1912
1912
  const after = line.slice(cursorCol);
1913
+ if (after.length > 0) {
1914
+ return /* @__PURE__ */ jsxs3(Box3, { children: [
1915
+ /* @__PURE__ */ jsx3(Text3, { color: "cyan", children: prefix }),
1916
+ /* @__PURE__ */ jsx3(Text3, { children: before }),
1917
+ /* @__PURE__ */ jsx3(Text3, { inverse: true, children: after[0] }),
1918
+ /* @__PURE__ */ jsx3(Text3, { children: after.slice(1) })
1919
+ ] }, idx);
1920
+ }
1913
1921
  return /* @__PURE__ */ jsxs3(Box3, { children: [
1914
1922
  /* @__PURE__ */ jsx3(Text3, { color: "cyan", children: prefix }),
1915
1923
  /* @__PURE__ */ jsx3(Text3, { children: before }),
1916
- /* @__PURE__ */ jsx3(Text3, { color: "cyan", children: CURSOR_CHAR }),
1917
- /* @__PURE__ */ jsx3(Text3, { children: after })
1924
+ /* @__PURE__ */ jsx3(Text3, { color: "cyan", children: CURSOR_CHAR })
1918
1925
  ] }, idx);
1919
1926
  }) });
1920
1927
  };
@@ -2134,12 +2141,13 @@ function confirmSelection(inputText, selectedPath) {
2134
2141
 
2135
2142
  // src/ui/mouseInput.ts
2136
2143
  var SGR_MOUSE_RE = /^\x1b\[<(\d+);\d+;\d+[Mm]/;
2137
- function isMouseEvent(data) {
2144
+ function mouseEventLength(data) {
2138
2145
  const s = typeof data === "string" ? data : data.toString("binary");
2139
- if (!s) return false;
2140
- if (SGR_MOUSE_RE.test(s)) return true;
2141
- if (s.length >= 6 && s.charCodeAt(0) === 27 && s[1] === "[" && s[2] === "M") return true;
2142
- return false;
2146
+ if (!s) return 0;
2147
+ const sgrMatch = SGR_MOUSE_RE.exec(s);
2148
+ if (sgrMatch) return sgrMatch[0].length;
2149
+ if (s.length >= 6 && s.charCodeAt(0) === 27 && s[1] === "[" && s[2] === "M") return 6;
2150
+ return 0;
2143
2151
  }
2144
2152
  function parseMouseScroll(data) {
2145
2153
  const s = typeof data === "string" ? data : data.toString("binary");
@@ -2984,8 +2992,11 @@ function App({ config: config2, version: version2, autoMode: autoMode2 = false,
2984
2992
  if (event === "readable") {
2985
2993
  const chunk = stdin.read();
2986
2994
  if (chunk !== null) {
2987
- if (isMouseEvent(chunk)) {
2988
- const scrollEvent = parseMouseScroll(chunk);
2995
+ const s = typeof chunk === "string" ? chunk : chunk.toString("binary");
2996
+ const mouseLen = mouseEventLength(s);
2997
+ if (mouseLen > 0) {
2998
+ const mouseStr = s.slice(0, mouseLen);
2999
+ const scrollEvent = parseMouseScroll(mouseStr);
2989
3000
  if (scrollEvent) {
2990
3001
  if (scrollEvent.direction === "up") {
2991
3002
  setScrollOffset((prev) => Math.min(prev + 3, Math.max(0, totalLinesRef.current - 1)));
@@ -2993,9 +3004,15 @@ function App({ config: config2, version: version2, autoMode: autoMode2 = false,
2993
3004
  setScrollOffset((prev) => Math.max(0, prev - 3));
2994
3005
  }
2995
3006
  }
2996
- return false;
3007
+ const remainder = s.slice(mouseLen);
3008
+ if (remainder.length > 0) {
3009
+ stdin.unshift(
3010
+ typeof chunk === "string" ? remainder : Buffer.from(remainder, "binary")
3011
+ );
3012
+ }
3013
+ } else {
3014
+ stdin.unshift(chunk);
2997
3015
  }
2998
- stdin.unshift(chunk);
2999
3016
  }
3000
3017
  }
3001
3018
  return origEmit.apply(stdin, [event, ...args]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",