@zhongqian97-code/ecode 0.3.10 → 0.3.11

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 +18 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2188,19 +2188,28 @@ function App({ config: config2, version: version2, autoMode: autoMode2 = false,
2188
2188
  useEffect3(() => {
2189
2189
  if (!stdin || !stdout) return;
2190
2190
  stdout.write("\x1B[?1000h\x1B[?1006h");
2191
- const onMouseData = (data) => {
2192
- const event = parseMouseScroll(data);
2193
- if (!event) return;
2194
- if (event.direction === "up") {
2195
- setScrollOffset((prev) => Math.min(prev + 3, Math.max(0, totalLinesRef.current - 1)));
2196
- } else {
2197
- setScrollOffset((prev) => Math.max(0, prev - 3));
2191
+ const origEmit = stdin.emit;
2192
+ stdin.emit = function(event, ...args) {
2193
+ if (event === "readable") {
2194
+ const chunk = stdin.read();
2195
+ if (chunk !== null) {
2196
+ const mouseEvent = parseMouseScroll(chunk);
2197
+ if (mouseEvent) {
2198
+ if (mouseEvent.direction === "up") {
2199
+ setScrollOffset((prev) => Math.min(prev + 3, Math.max(0, totalLinesRef.current - 1)));
2200
+ } else {
2201
+ setScrollOffset((prev) => Math.max(0, prev - 3));
2202
+ }
2203
+ return false;
2204
+ }
2205
+ stdin.unshift(chunk);
2206
+ }
2198
2207
  }
2208
+ return origEmit.apply(stdin, [event, ...args]);
2199
2209
  };
2200
- stdin.on("data", onMouseData);
2201
2210
  return () => {
2202
2211
  stdout.write("\x1B[?1000l\x1B[?1006l");
2203
- stdin.off("data", onMouseData);
2212
+ stdin.emit = origEmit;
2204
2213
  };
2205
2214
  }, [stdin, stdout]);
2206
2215
  useEffect3(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",