@rol1n/windows-wheel-fix 0.0.0-stage → 0.1.0
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
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# windows-wheel-fix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Restore mouse-wheel reporting for Pi running under Windows ConPTY/Zellij when terminal initialization causes wheel events to be translated into prompt-history navigation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pi install npm:@rol1n/windows-wheel-fix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Also included in `@rol1n/pi-kit`. The entrypoint returns immediately outside native Windows, so an aggregate installation does not apply this terminal patch on Linux, WSL, or macOS.
|
|
12
|
+
|
|
13
|
+
## Behavior
|
|
14
|
+
|
|
15
|
+
The extension re-emits mouse-reporting control sequences after session startup and whenever stdin returns to raw mode. It has no slash command, settings section, credentials, or external binary requirement.
|
|
16
|
+
|
|
17
|
+
The targeted upstream issue is [earendil-works/pi#9656](https://github.com/earendil-works/pi/issues/9656). If your installed Pi/terminal versions already resolve that issue, disable the extension through Pi's package resource configuration.
|
|
18
|
+
|
|
19
|
+
## Source layout
|
|
20
|
+
|
|
21
|
+
The small, platform-specific patch stays in one `index.ts` beside this README.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# windows-wheel-fix
|
|
2
|
+
|
|
3
|
+
Restore mouse-wheel reporting for Pi running under Windows ConPTY/Zellij when terminal initialization causes wheel events to be translated into prompt-history navigation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pi install npm:@rol1n/windows-wheel-fix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Also included in `@rol1n/pi-kit`. The entrypoint returns immediately outside native Windows, so an aggregate installation does not apply this terminal patch on Linux, WSL, or macOS.
|
|
12
|
+
|
|
13
|
+
## Behavior
|
|
14
|
+
|
|
15
|
+
The extension re-emits mouse-reporting control sequences after session startup and whenever stdin returns to raw mode. It has no slash command, settings section, credentials, or external binary requirement.
|
|
16
|
+
|
|
17
|
+
The targeted upstream issue is [earendil-works/pi#9656](https://github.com/earendil-works/pi/issues/9656). If your installed Pi/terminal versions already resolve that issue, disable the extension through Pi's package resource configuration.
|
|
18
|
+
|
|
19
|
+
## Source layout
|
|
20
|
+
|
|
21
|
+
The small, platform-specific patch stays in one `index.ts` beside this README.
|
|
@@ -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,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rol1n/windows-wheel-fix",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
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": "extensions/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
|
+
"files": [
|
|
25
|
+
"extensions/windows-wheel-fix",
|
|
26
|
+
"extensions/windows-wheel-fix/README.md"
|
|
27
|
+
],
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@earendil-works/pi-ai": "*",
|
|
30
|
+
"@earendil-works/pi-agent-core": "*",
|
|
31
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
32
|
+
"@earendil-works/pi-tui": "*",
|
|
33
|
+
"typebox": "*"
|
|
34
|
+
},
|
|
35
|
+
"pi": {
|
|
36
|
+
"extensions": [
|
|
37
|
+
"./extensions/windows-wheel-fix/index.ts"
|
|
38
|
+
],
|
|
39
|
+
"skills": [],
|
|
40
|
+
"prompts": [],
|
|
41
|
+
"themes": []
|
|
42
|
+
}
|
|
43
|
+
}
|