pi-stereo-view 0.1.6 → 0.1.7
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 +7 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/preferences.ts +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.7 - 2026-10-24
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Keep panel zoom and split on/off temporary to the current session. New sessions always show both panels using the saved layout, order and sizes.
|
|
8
|
+
- Ignore zoom and split-state values from older settings files without resetting panel sizes or timestamp and copy-button preferences.
|
|
9
|
+
|
|
3
10
|
## 0.1.6 - 2026-10-24
|
|
4
11
|
|
|
5
12
|
### Fixed
|
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ Keyboard scrolling (`PgUp`/`PgDn` and Pi's other scroll keys) moves the active p
|
|
|
157
157
|
|
|
158
158
|
## Settings and limits
|
|
159
159
|
|
|
160
|
-
Your layout, panel order, sizes,
|
|
160
|
+
Your layout, panel order, sizes, timestamp and copy-button settings are saved automatically. Each new session opens both panels in that arrangement. Zooming one panel or turning split off is temporary and does not carry over to another session.
|
|
161
161
|
|
|
162
162
|
- Tested with Pi 1.1.0. Requires Node.js 22.19 or newer.
|
|
163
163
|
- Regular mode shows one combined history.
|
package/package.json
CHANGED
package/src/preferences.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/** Display state; mode and zoom are session-only, while arrangement and display choices are saved. */
|
|
6
6
|
export interface Preferences {
|
|
7
7
|
mode: "split" | "combined";
|
|
8
8
|
/** Left means first: left in columns, top in rows. */
|
|
@@ -35,19 +35,18 @@ export async function loadPreferences(file: string): Promise<Preferences> {
|
|
|
35
35
|
// The first version only had columns; keep that saved arrangement.
|
|
36
36
|
const layout = record.layout === undefined ? "columns" : record.layout;
|
|
37
37
|
const chatHeight = record.chatHeight === undefined ? defaults.chatHeight : record.chatHeight;
|
|
38
|
-
const zoom = record.zoom === undefined ? defaults.zoom : record.zoom;
|
|
39
38
|
const showTimestamps = record.showTimestamps === undefined ? defaults.showTimestamps : record.showTimestamps;
|
|
40
39
|
const showCopyButtons = record.showCopyButtons === undefined ? defaults.showCopyButtons : record.showCopyButtons;
|
|
41
|
-
if ((record.
|
|
42
|
-
(record.side !== "left" && record.side !== "right") ||
|
|
40
|
+
if ((record.side !== "left" && record.side !== "right") ||
|
|
43
41
|
(record.chatWidth !== null && (typeof record.chatWidth !== "number" || !Number.isInteger(record.chatWidth) ||
|
|
44
42
|
record.chatWidth < 24 || record.chatWidth > 240)) ||
|
|
45
43
|
(layout !== "columns" && layout !== "rows") ||
|
|
46
44
|
(chatHeight !== null && (typeof chatHeight !== "number" || !Number.isInteger(chatHeight) || chatHeight < 4 || chatHeight > 240)) ||
|
|
47
|
-
|
|
45
|
+
typeof showTimestamps !== "boolean" || typeof showCopyButtons !== "boolean") {
|
|
48
46
|
throw new Error("Invalid pi-stereo-view preferences");
|
|
49
47
|
}
|
|
50
|
-
|
|
48
|
+
// Legacy files may contain mode/zoom. Every session starts with both panels visible.
|
|
49
|
+
return { mode: "split", side: record.side, chatWidth: record.chatWidth, layout, chatHeight, zoom: null, showTimestamps, showCopyButtons };
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
/** Atomically save only the display settings, never session messages. */
|
|
@@ -55,7 +54,9 @@ export async function savePreferences(file: string, preferences: Preferences): P
|
|
|
55
54
|
await mkdir(path.dirname(file), { recursive: true });
|
|
56
55
|
const temporary = file + "." + randomUUID() + ".tmp";
|
|
57
56
|
try {
|
|
58
|
-
|
|
57
|
+
const { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons } = preferences;
|
|
58
|
+
const saved = { side, chatWidth, layout, chatHeight, showTimestamps, showCopyButtons };
|
|
59
|
+
await writeFile(temporary, JSON.stringify(saved, null, 2) + "\n", { mode: 0o600 });
|
|
59
60
|
await rename(temporary, file);
|
|
60
61
|
} finally {
|
|
61
62
|
await rm(temporary, { force: true });
|