@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.
- package/dist/index.js +18 -9
- 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
|
|
2192
|
-
|
|
2193
|
-
if (
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
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.
|
|
2212
|
+
stdin.emit = origEmit;
|
|
2204
2213
|
};
|
|
2205
2214
|
}, [stdin, stdout]);
|
|
2206
2215
|
useEffect3(() => {
|