@rol1n/windows-wheel-fix 0.0.0-stage → 0.1.1
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/README.md +11 -2
- package/index.ts +44 -0
- package/package.json +37 -4
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# windows-wheel-fix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Restores mouse-wheel reporting for Pi under Windows ConPTY / Zellij ([earendil-works/pi#9656](https://github.com/earendil-works/pi/issues/9656)) by re-emitting mouse DECSET sequences once raw mode is active. No-op on non-Windows platforms.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pi install npm:@rol1n/windows-wheel-fix
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Also included in `@rol1n/pi-kit`.
|
package/index.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* windows-wheel-fix.ts — Fix mouse wheel alternateScroll in Zellij / Windows ConPTY
|
|
3
|
+
*
|
|
4
|
+
* Upstream issue: https://github.com/earendil-works/pi/issues/9656
|
|
5
|
+
*
|
|
6
|
+
* Root cause:
|
|
7
|
+
* TuiAltScreen writes the mouse tracking DECSET burst (?1000h ?1002h ?1004h ?1006h)
|
|
8
|
+
* during beforeTerminalStart() BEFORE stdin is switched to raw mode and ENABLE_VIRTUAL_TERMINAL_INPUT
|
|
9
|
+
* is applied. On Windows, ConPTY silently swallows these sequences while in cooked mode,
|
|
10
|
+
* so Zellij never detects that the inner pane requested mouse reporting.
|
|
11
|
+
* Zellij then falls back to xterm alternateScroll, translating mouse wheel ticks into
|
|
12
|
+
* Up/Down arrow keys (which cycles prompt history in Pi's fullscreen editor).
|
|
13
|
+
*
|
|
14
|
+
* Fix:
|
|
15
|
+
* Re-emit the mouse DECSET sequence once raw mode and VT input are established.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
19
|
+
|
|
20
|
+
export default function (pi: ExtensionAPI) {
|
|
21
|
+
if (process.platform !== "win32") return;
|
|
22
|
+
|
|
23
|
+
const MOUSE_BURST = "\x1b[?1000h\x1b[?1002h\x1b[?1004h\x1b[?1006h";
|
|
24
|
+
|
|
25
|
+
// 1. Session start: raw mode is guaranteed active
|
|
26
|
+
pi.on("session_start", async () => {
|
|
27
|
+
process.stdout.write(MOUSE_BURST);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 2. Intercept setRawMode to resend burst whenever raw mode is engaged (e.g. TUI start / mode switch)
|
|
31
|
+
const rawStream = process.stdin as NodeJS.ReadStream;
|
|
32
|
+
const originalSetRawMode = rawStream?.setRawMode?.bind(rawStream);
|
|
33
|
+
if (originalSetRawMode) {
|
|
34
|
+
rawStream.setRawMode = function (mode: boolean) {
|
|
35
|
+
const res = originalSetRawMode(mode);
|
|
36
|
+
if (mode) {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
process.stdout.write(MOUSE_BURST);
|
|
39
|
+
}, 30);
|
|
40
|
+
}
|
|
41
|
+
return res;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rol1n/windows-wheel-fix",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "windows-wheel-fix extension from pi-kit",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/RolinShmily/pi-kit.git",
|
|
12
|
+
"directory": "windows-wheel-fix"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/RolinShmily/pi-kit#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/RolinShmily/pi-kit/issues"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.19.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@earendil-works/pi-ai": "*",
|
|
26
|
+
"@earendil-works/pi-agent-core": "*",
|
|
27
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
28
|
+
"@earendil-works/pi-tui": "*",
|
|
29
|
+
"typebox": "*"
|
|
30
|
+
},
|
|
31
|
+
"pi": {
|
|
32
|
+
"extensions": [
|
|
33
|
+
"./index.ts"
|
|
34
|
+
],
|
|
35
|
+
"skills": [],
|
|
36
|
+
"prompts": [],
|
|
37
|
+
"themes": []
|
|
38
|
+
}
|
|
39
|
+
}
|