pi-stereo-view 0.1.0 → 0.1.2
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/CHANGELOG.md +9 -0
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/index.ts +6 -1
- package/src/layout.ts +24 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
- PgUp/PgDn and Pi's other keyboard scroll keys now move the active panel (marked with `●`) instead of always Activity. Pi's built-in history search follows the active panel too.
|
|
6
|
+
- `Ctrl+Alt+Up` or `Ctrl+Alt+Down` switches the active panel; press again to switch back.
|
|
7
|
+
|
|
8
|
+
## 0.1.1
|
|
9
|
+
|
|
10
|
+
- Mouse wheel over Conversation or its header no longer scrolls Activity when Conversation is too short to scroll.
|
|
11
|
+
|
|
3
12
|
## 0.1.0
|
|
4
13
|
|
|
5
14
|
First release.
|
package/README.md
CHANGED
|
@@ -128,6 +128,8 @@ The same controls are available without the mouse:
|
|
|
128
128
|
|
|
129
129
|
`Ctrl+Alt+T` toggles split, `Ctrl+Alt+S` swaps panels, and `Ctrl+Alt+Left/Right` resizes Conversation along the current split direction.
|
|
130
130
|
|
|
131
|
+
Keyboard scrolling (`PgUp`/`PgDn` and Pi's other scroll keys) moves the active panel, marked with `●`. Clicking or scrolling a panel makes it active. `Ctrl+Alt+Up` or `Ctrl+Alt+Down` switches to the other panel; press either again to switch back.
|
|
132
|
+
|
|
131
133
|
## Settings and limits
|
|
132
134
|
|
|
133
135
|
Your layout, panel order, sizes, zoom, split on/off and timestamp settings are saved automatically and restored next time.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -154,7 +154,7 @@ export default function transcript(pi: ExtensionAPI): void {
|
|
|
154
154
|
if (action === "toggle" || action === "") toggle();
|
|
155
155
|
else if (action === "settings") await openSettings(ctx);
|
|
156
156
|
else if (action === "help") {
|
|
157
|
-
ctx.ui.notify("pi-stereo-view icons: ▣ combined, ◫ split, ▤ rows, ▥ columns, ↕/↔ swap, ↗ expand, ↙ restore, ⌕ search, ≡ settings. Ctrl+F searches the active panel. Drag the ═ or ║ divider to resize.", "info");
|
|
157
|
+
ctx.ui.notify("pi-stereo-view icons: ▣ combined, ◫ split, ▤ rows, ▥ columns, ↕/↔ swap, ↗ expand, ↙ restore, ⌕ search, ≡ settings. Ctrl+F searches and PgUp/PgDn scroll the active panel; Ctrl+Alt+Up/Down switches it. Drag the ═ or ║ divider to resize.", "info");
|
|
158
158
|
} else if (action === "swap") layout.swap();
|
|
159
159
|
else if (action === "width" && /^\d+$/.test(target ?? "")) layout.setWidth(Number(target));
|
|
160
160
|
else if (action === "height" && target === "auto") layout.setHeight(null);
|
|
@@ -173,6 +173,11 @@ export default function transcript(pi: ExtensionAPI): void {
|
|
|
173
173
|
});
|
|
174
174
|
pi.registerShortcut("ctrl+alt+t", { description: "Toggle split history", handler: async () => toggle() });
|
|
175
175
|
pi.registerShortcut("ctrl+alt+s", { description: "Swap stereo-view panels", handler: async () => layout?.swap() });
|
|
176
|
+
for (const key of ["ctrl+alt+up", "ctrl+alt+down"] as const) {
|
|
177
|
+
pi.registerShortcut(key, { description: "Move keyboard scrolling to the other stereo-view panel", handler: async () => {
|
|
178
|
+
layout?.cyclePanel();
|
|
179
|
+
} });
|
|
180
|
+
}
|
|
176
181
|
pi.registerShortcut("ctrl+alt+left", { description: "Shrink conversation along the split axis", handler: async () => {
|
|
177
182
|
layout?.resize(-1);
|
|
178
183
|
} });
|
package/src/layout.ts
CHANGED
|
@@ -20,8 +20,10 @@ const MIN_ROWS = 4;
|
|
|
20
20
|
const BUTTON_WIDTH = 5;
|
|
21
21
|
|
|
22
22
|
class PanelScrollView extends ScrollView {
|
|
23
|
-
constructor(component: Component, options: ScrollViewOptions, private readonly interact: () => void) {
|
|
23
|
+
constructor(component: Component, options: ScrollViewOptions, private readonly interact: () => void, active: () => boolean) {
|
|
24
24
|
super(component, options);
|
|
25
|
+
// Pi sends keyboard scrolling and native search to the primary ScrollView; follow the active panel.
|
|
26
|
+
Object.defineProperty(this, "primary", { get: active });
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
override handleMouse(event: TuiMouseEvent): ReturnType<Container["handleMouse"]> {
|
|
@@ -59,6 +61,17 @@ class TranscriptPane extends VStack {
|
|
|
59
61
|
]);
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
override handleMouse(event: TuiMouseEvent): ReturnType<Container["handleMouse"]> {
|
|
65
|
+
if (event.type !== "wheel") return undefined;
|
|
66
|
+
// Native wheel routing gives any unused delta to the primary panel, Activity.
|
|
67
|
+
// Consume it here so the wheel only moves the panel under the pointer.
|
|
68
|
+
this.view.scrollBy(event.wheelDelta ?? 0);
|
|
69
|
+
return { handled: true, target: {
|
|
70
|
+
component: this, originX: event.screenX - event.x, originY: event.screenY - event.y,
|
|
71
|
+
width: event.width, height: event.height,
|
|
72
|
+
} };
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
override render(width: number): string[] {
|
|
63
76
|
// Native layout measures height here, then paints the original header and ScrollView.
|
|
64
77
|
// Empty preview rows avoid composing colored history text in ancestor measurements.
|
|
@@ -174,8 +187,9 @@ export class TranscriptLayout {
|
|
|
174
187
|
scrollbarTrackStyle: scroll.scrollbarTrackStyle,
|
|
175
188
|
scrollbarThumbStyle: scroll.scrollbarThumbStyle,
|
|
176
189
|
};
|
|
177
|
-
this.activity = new PanelScrollView(activityDocument,
|
|
178
|
-
|
|
190
|
+
this.activity = new PanelScrollView(activityDocument, scrollOptions, () => this.activate("activity"),
|
|
191
|
+
() => this.searchPane() === "activity");
|
|
192
|
+
this.chat = new PanelScrollView(chatDocument, scrollOptions, () => this.activate("chat"), () => this.searchPane() === "chat");
|
|
179
193
|
let historyHeight = 0;
|
|
180
194
|
const shown = ({ width, height }: { width: number; height: number }): boolean => {
|
|
181
195
|
const previousHeight = historyHeight;
|
|
@@ -557,6 +571,13 @@ export class TranscriptLayout {
|
|
|
557
571
|
this.changed();
|
|
558
572
|
}
|
|
559
573
|
|
|
574
|
+
/** Cycle keyboard scrolling and search to the other panel. */
|
|
575
|
+
cyclePanel(): void {
|
|
576
|
+
const pane = this.searchPane();
|
|
577
|
+
if (!pane || this.preferences.zoom) return;
|
|
578
|
+
this.activate(pane === "chat" ? "activity" : "chat");
|
|
579
|
+
}
|
|
580
|
+
|
|
560
581
|
/** Scroll one native pane without moving the other. */
|
|
561
582
|
scroll(pane: Pane, lines: number): void {
|
|
562
583
|
(pane === "chat" ? this.chat : this.activity)?.scrollBy(lines);
|