Hide the thread list with B; both side panels' visibility kept across runs

This commit is contained in:
Callum Alpass committed 2026-11-03 01:58:09 +11:00
1 parent ae1068a1ac
commit e2d2892c52
5 files changed
+59 -11

No files matched your search

+11 -2
View File
@@ -12,9 +12,13 @@ export interface Layout {
readonly listWidth: number | null;
/** The details column's width once its border is dragged; null is the default width. */
readonly detailsWidth: number | null;
/** The thread list hidden with `b`. */
readonly listHidden: boolean;
/** The details column shown or hidden with `d`; null follows the window's width. */
readonly details: boolean | null;
}
export const DEFAULT_LAYOUT: Layout = { listWidth: null, detailsWidth: null };
export const DEFAULT_LAYOUT: Layout = { listWidth: null, detailsWidth: null, listHidden: false, details: null };
const layoutPath = () => join(configDir(), "layout.json");
@@ -29,7 +33,12 @@ export async function loadLayout(): Promise<Layout> {
export function parseLayout(raw: unknown): Layout {
const record = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
return { listWidth: positiveInteger(record.listWidth), detailsWidth: positiveInteger(record.detailsWidth) };
return {
listWidth: positiveInteger(record.listWidth),
detailsWidth: positiveInteger(record.detailsWidth),
listHidden: record.listHidden === true,
details: typeof record.details === "boolean" ? record.details : null,
};
}
const positiveInteger = (value: unknown) => (typeof value === "number" && Number.isInteger(value) && value > 0 ? value : null);