proper-base 0.6.0 → 0.7.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 +36 -13
- package/UPDATES.md +129 -0
- package/index.ts +76 -111
- package/package.json +4 -3
- package/src/auto-update/availability.ts +132 -0
- package/src/auto-update/index.ts +403 -0
- package/src/auto-update/inventory.mjs +96 -0
- package/src/auto-update/readiness.ts +94 -0
- package/src/auto-update/runtime.ts +268 -0
- package/src/auto-update/settings.ts +146 -0
- package/src/base-keybindings.ts +114 -0
- package/src/clipboard-selection.ts +310 -0
- package/src/fast-mode.ts +73 -12
- package/src/footer-colors.ts +55 -3
- package/src/host-interop.ts +49 -0
- package/src/image-preview.ts +75 -66
- package/src/proactive-delegation.ts +33 -14
- package/src/prompt-display-host.ts +136 -0
- package/src/prompt-display.ts +44 -82
- package/src/prompt-sections.ts +16 -0
- package/src/session-list.ts +132 -21
- package/src/skill-context.ts +52 -14
- package/src/startup-defaults.ts +4 -122
- package/src/sticky-defaults.ts +196 -0
- package/src/wheel-scroll.ts +24 -27
package/src/wheel-scroll.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pi's fullscreen renderer scrolls its transcript exactly one line per
|
|
3
|
-
* mouse-wheel report
|
|
4
|
-
* and pi passes no override and exposes no setting. Terminals natively
|
|
5
|
-
* multiply a wheel notch to about three lines, so fullscreen scrolling feels
|
|
6
|
-
* slower than every other terminal surface.
|
|
7
|
-
*
|
|
8
|
-
* No escape sequence lets an application query the terminal's own wheel
|
|
9
|
-
* configuration, so the step defaults to the 3-line application convention
|
|
10
|
-
* (vim, less) and honors a per-terminal `PROPER_WHEEL_SCROLL_LINES`
|
|
11
|
-
* environment override that each terminal's profile can export.
|
|
3
|
+
* mouse-wheel report. Proper-base raises that to the terminal convention.
|
|
12
4
|
*/
|
|
13
5
|
|
|
14
6
|
const DEFAULT_WHEEL_SCROLL_LINES = 3;
|
|
7
|
+
const INSTALLED = Symbol.for("pi-proper-base.wheel-scroll-lines");
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
type WheelHost = {
|
|
9
|
+
type WheelController = { restore(): void };
|
|
10
|
+
type WheelHost = {
|
|
11
|
+
wheelScrollLines?: unknown;
|
|
12
|
+
[INSTALLED]?: WheelController;
|
|
13
|
+
};
|
|
18
14
|
|
|
19
|
-
/** Lines per wheel event: a positive integer override, else
|
|
15
|
+
/** Lines per wheel event: a positive integer override, else three. */
|
|
20
16
|
export function resolveWheelScrollLines(
|
|
21
17
|
env: Record<string, string | undefined> = process.env,
|
|
22
18
|
): number {
|
|
@@ -24,23 +20,24 @@ export function resolveWheelScrollLines(
|
|
|
24
20
|
return parsed >= 1 ? parsed : DEFAULT_WHEEL_SCROLL_LINES;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
/**
|
|
28
|
-
* Raise the fullscreen renderer's wheel step. Only a renderer that already
|
|
29
|
-
* exposes a numeric `wheelScrollLines` is touched, so regular mode — where
|
|
30
|
-
* the terminal scrolls natively — and a renamed upstream field fail open to
|
|
31
|
-
* pi's own behavior.
|
|
32
|
-
*
|
|
33
|
-
* ponytail: SGR wheel reports cannot distinguish a discrete mouse notch from
|
|
34
|
-
* one line of a high-rate trackpad stream, so a terminal emitting one report
|
|
35
|
-
* per native line scrolls proportionally faster; exporting
|
|
36
|
-
* PROPER_WHEEL_SCROLL_LINES=1 there restores pi's original pace.
|
|
37
|
-
*/
|
|
23
|
+
/** Patch a fullscreen renderer and return an ownership-checked restoration. */
|
|
38
24
|
export function installWheelScrollLines(
|
|
39
25
|
tui: unknown,
|
|
40
26
|
lines: number = resolveWheelScrollLines(),
|
|
41
|
-
):
|
|
27
|
+
): (() => void) | undefined {
|
|
42
28
|
const host = tui as WheelHost;
|
|
43
|
-
|
|
44
|
-
host.wheelScrollLines
|
|
45
|
-
|
|
29
|
+
host[INSTALLED]?.restore();
|
|
30
|
+
if (typeof host.wheelScrollLines !== "number") return undefined;
|
|
31
|
+
const original = host.wheelScrollLines;
|
|
32
|
+
const applied = Math.floor(lines);
|
|
33
|
+
const controller: WheelController = {
|
|
34
|
+
restore() {
|
|
35
|
+
if (host[INSTALLED] !== controller) return;
|
|
36
|
+
if (host.wheelScrollLines === applied) host.wheelScrollLines = original;
|
|
37
|
+
delete host[INSTALLED];
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
host.wheelScrollLines = applied;
|
|
41
|
+
host[INSTALLED] = controller;
|
|
42
|
+
return () => controller.restore();
|
|
46
43
|
}
|