@zhongqian97-code/ecode 0.3.11 → 0.3.12

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 +15 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2100,6 +2100,13 @@ function confirmSelection(inputText, selectedPath) {
2100
2100
 
2101
2101
  // src/ui/mouseInput.ts
2102
2102
  var SGR_MOUSE_RE = /^\x1b\[<(\d+);\d+;\d+[Mm]/;
2103
+ function isMouseEvent(data) {
2104
+ const s = typeof data === "string" ? data : data.toString("binary");
2105
+ if (!s) return false;
2106
+ if (SGR_MOUSE_RE.test(s)) return true;
2107
+ if (s.length >= 6 && s.charCodeAt(0) === 27 && s[1] === "[" && s[2] === "M") return true;
2108
+ return false;
2109
+ }
2103
2110
  function parseMouseScroll(data) {
2104
2111
  const s = typeof data === "string" ? data : data.toString("binary");
2105
2112
  if (!s) return null;
@@ -2193,12 +2200,14 @@ function App({ config: config2, version: version2, autoMode: autoMode2 = false,
2193
2200
  if (event === "readable") {
2194
2201
  const chunk = stdin.read();
2195
2202
  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));
2203
+ if (isMouseEvent(chunk)) {
2204
+ const scrollEvent = parseMouseScroll(chunk);
2205
+ if (scrollEvent) {
2206
+ if (scrollEvent.direction === "up") {
2207
+ setScrollOffset((prev) => Math.min(prev + 3, Math.max(0, totalLinesRef.current - 1)));
2208
+ } else {
2209
+ setScrollOffset((prev) => Math.max(0, prev - 3));
2210
+ }
2202
2211
  }
2203
2212
  return false;
2204
2213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",