Auto picks panes from 900 px wide, a laptop's window too, not 1600

One pane and the stack of earlier ones beside it read well from there. The browser tests start in
the column (playwright.config.ts) where they mean it; a panes test lets the layout follow the window
(helpers.ts autoLayout). New: auto gives panes at 1366 and the column at 820 and 390.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-16 16:31:21 -05:00
1 parent f8d663ebc1
commit 5f6ea8e5c9
13 files changed
+53 -19

No files matched your search

+3 -3
View File
@@ -92,9 +92,9 @@ Press `?` for every key. The short version:
mark, `[` `]` up and down a column (a click on a pane does it), and the commands typed at `:`
that no menu lists (`/branch`, `/switch`, `/merge`, `/user`, `/link`, …), which the menu's
Command line… opens for typing.
- On a window 1600 px wide or more the page opens as panes side by side, after Andy Matuschak's
notes: the library, the open document, its open sections. `v` switches between panes and the
single column, `/view auto|column|panes` sets it.
- On a window 900 px wide or more, a laptop's too, the page opens as panes side by side, after
Andy Matuschak's notes: the library, the open document, its open sections. `v` switches between
panes and the single column, `/view auto|column|panes` sets it.
- **Opening.** `Enter`, `l` or a click on a row, a link, a link in an article, or a "Linked from",
"Mentioned in" or Related row opens its target in the next column, beside what is already open
there (so do Ctrl-, Cmd- and middle clicks); `Shift+Enter` or a Shift-click opens it in place of
+4 -1
View File
@@ -5,18 +5,21 @@
* again in a later revision, or listed as detached when its words are gone.
*/
import { expect, test, type Page } from "@playwright/test";
import { command, idle, jump, keys, seedLinks, selected, settle, state } from "./helpers";
import { autoLayout, command, idle, jump, keys, seedLinks, selected, settle, state } from "./helpers";
const panes = (page: Page) => page.locator(".strip .pane");
async function wide(page: Page, path = "/doc/fixed-points") {
await page.setViewportSize({ width: 1920, height: 1080 });
await autoLayout(page);
await page.goto(path);
await page.waitForSelector(".strip .pane");
await page.evaluate(() => document.fonts.ready);
}
async function column(page: Page, path: string) {
await page.setViewportSize({ width: 1440, height: 900 });
// After wide(), this page's layout follows the window, and 1440 px is wide enough for panes.
if (page.url().startsWith("http")) await page.evaluate(() => localStorage.setItem("ie:settings", JSON.stringify({ ...JSON.parse(localStorage.getItem("ie:settings") ?? "{}"), view: "column" })));
await page.goto(path);
await page.waitForFunction(() => (globalThis as any).__ie?.ready);
}
+4 -2
View File
@@ -8,7 +8,7 @@
* the documents are hoisted to (z) as in panes.spec.ts.
*/
import { expect, test, type Page } from "@playwright/test";
import { focusedTitle, jump, keys, seedLinks, selected, settle, state } from "./helpers";
import { autoLayout, command, focusedTitle, jump, keys, seedLinks, selected, settle, state } from "./helpers";
/** The first tree of panes by title, the picked child starred: [title, [children]] or a leaf's title. */
const tree = (page: Page) =>
@@ -114,7 +114,8 @@ test.describe.configure({ mode: "serial" });
test.beforeAll(async ({ request }) => {
await seedLinks(request);
});
test.beforeEach(async ({ context }) => {
test.beforeEach(async ({ context, page }) => {
await autoLayout(page);
await context.route(/wikipedia\.org|wikimedia\.org|stanford\.edu|example\.org/, (r) => r.abort());
});
test.afterEach(({ page }) => settle(page));
@@ -771,6 +772,7 @@ test("in the column a Shift open is a plain open, and the status line says why o
await page.setViewportSize({ width: 1440, height: 900 });
await page.goto("/doc/fixed-points");
await page.waitForFunction(() => (globalThis as any).__ie?.ready);
await command(page, "/view column");
await jump(page, "Recursion without names");
await keys(page, "Shift+Enter");
await expect(page.locator(".status .message")).toContainText("panes view");
+11
View File
@@ -18,6 +18,17 @@ export interface Sample {
/** Run a function on the page's store and return what it returns. */
export const state = <T>(page: Page, fn: (s: any) => T): Promise<T> => page.evaluate(`(${fn})(globalThis.__ie)`) as Promise<T>;
/**
* Let this page's layout follow the window, as a reader's does (`/view auto`), from its first load:
* the tests start in the column (playwright.config.ts). Later loads keep what the page has set.
*/
export const autoLayout = (page: Page) =>
page.addInitScript(() => {
if (sessionStorage.getItem("e2e:auto")) return;
sessionStorage.setItem("e2e:auto", "1");
localStorage.removeItem("ie:settings");
});
/** Press space-separated keys, in order. */
export const keys = async (page: Page, seq: string) => {
for (const k of seq.split(" ")) await page.keyboard.press(k);
+4 -1
View File
@@ -5,7 +5,7 @@
* the address it would have gone to.
*/
import { expect, test, type Page } from "@playwright/test";
import { command, focusedTitle, jump, keys, seedLinks, selected, settle, state, writeReport, type Sample } from "./helpers";
import { autoLayout, command, focusedTitle, jump, keys, seedLinks, selected, settle, state, writeReport, type Sample } from "./helpers";
/** The panes' titles, left to right: a node's title, or W:article for a Wikipedia pane. */
const trail = (page: Page) =>
@@ -23,12 +23,15 @@ async function tabTo(page: Page, words: string) {
async function column(page: Page, path = "/doc/fixed-points") {
await page.setViewportSize({ width: 1440, height: 900 });
// After wide(), this page's layout follows the window, and 1440 px is wide enough for panes.
if (page.url().startsWith("http")) await page.evaluate(() => localStorage.setItem("ie:settings", JSON.stringify({ ...JSON.parse(localStorage.getItem("ie:settings") ?? "{}"), view: "column" })));
await page.goto(path);
await page.waitForFunction(() => (globalThis as any).__ie?.ready);
await page.evaluate(() => document.fonts.ready);
}
async function wide(page: Page, path = "/doc/fixed-points") {
await page.setViewportSize({ width: 1920, height: 1080 });
await autoLayout(page);
await page.goto(path);
await page.waitForSelector(".strip .pane");
await page.evaluate(() => document.fonts.ready);
+2 -1
View File
@@ -5,7 +5,7 @@
* their own documents and leave the first one alone: the other specs share it.
*/
import { expect, test, type Page } from "@playwright/test";
import { command, idle, jump, keys, settle, state, synced } from "./helpers";
import { autoLayout, command, idle, jump, keys, settle, state, synced } from "./helpers";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { parseDoc } from "../src/core/format";
@@ -324,6 +324,7 @@ test("the : commands do the same", async ({ page }) => {
test("the menu works in panes and at phone width", async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await autoLayout(page);
await open(page, "/doc/infinite-expand");
await expect(page.locator(".strip .pane")).toHaveCount(2); // the library, and the document
await openByMenu(page, "menu fixture");
+2 -1
View File
@@ -6,7 +6,7 @@
* other spec uses, and undo what they write.
*/
import { expect, test, type Locator, type Page } from "@playwright/test";
import { command, idle, keys, settle, state } from "./helpers";
import { autoLayout, command, idle, keys, settle, state } from "./helpers";
const DOC = "/doc/tuning-and-temperament";
const FIRST = "Two notes sound smooth together when their frequencies stand in a simple ratio such as 2 to 1 or 3 to 2.";
@@ -300,6 +300,7 @@ test("Lock: the menu, the badge, the status line and the help say lock; pin is a
test.describe("panes", () => {
test.use({ viewport: { width: 1920, height: 1080 } });
test.beforeEach(({ page }) => autoLayout(page));
const paneOf = (page: Page, title: string) => page.locator(".strip .pane", { has: page.locator(`:is(.pane-head h2, .top h1):text-is("${title}")`) }).first();
const trail = (page: Page) => state(page, (s) => s.trail.map((p: any) => (p.kind === "wiki" ? `W:${p.title}` : s.snap.nodes[p.id].title)));
+10 -5
View File
@@ -5,7 +5,7 @@
* (z) and start from it, as the first pane.
*/
import { expect, test, type Page } from "@playwright/test";
import { command, focusedTitle, idle, jump, keys, settle, state, writeReport, type Sample } from "./helpers";
import { autoLayout, command, focusedTitle, idle, jump, keys, settle, state, writeReport, type Sample } from "./helpers";
/** Each pane's title and box, left to right. */
const panes = (page: Page) =>
@@ -31,6 +31,7 @@ async function open(page: Page) {
test.use({ viewport: { width: 1920, height: 1080 } });
test.describe.configure({ mode: "serial" });
test.beforeEach(({ page }) => autoLayout(page));
test.afterEach(({ page }) => settle(page));
test("the library is the first pane, and a document opens in the next; reload and Back keep the place", async ({ page }) => {
@@ -63,13 +64,17 @@ test("the library is the first pane, and a document opens in the next; reload an
await expect.poll(() => paneTitles(page)).toEqual(["Library", "Infinispand", "The tides"]);
});
test("auto shows panes at 1920 px and one column at 1440; v and /view switch", async ({ page }) => {
test("auto shows panes at 1920 px and on a laptop's 1366, one column on a phone or a narrow window; v and /view switch", async ({ page }) => {
await open(page);
await expect(page.locator(".app.view-panes .strip .pane")).toHaveCount(1);
await expect(page.locator(".strip .pane.root h1")).toHaveText("Infinispand");
await page.setViewportSize({ width: 1440, height: 900 });
await expect(page.locator(".strip")).toHaveCount(0);
await expect(page.locator("article > .outline > .node").first()).toBeVisible();
await page.setViewportSize({ width: 1366, height: 768 });
await expect(page.locator(".app.view-panes .strip .pane")).toHaveCount(1);
for (const [width, height] of [[820, 900], [390, 800]]) {
await page.setViewportSize({ width, height });
await expect(page.locator(".strip"), `${width}`).toHaveCount(0);
await expect(page.locator("article > .outline > .node").first()).toBeVisible();
}
await page.setViewportSize({ width: 1920, height: 1080 });
await expect(page.locator(".strip .pane")).toHaveCount(1);
await keys(page, "v");
+2 -1
View File
@@ -7,7 +7,7 @@
* calculus, …) and the hashed-words embedder (IE_EMBED=fake).
*/
import { expect, test, type Page } from "@playwright/test";
import { command, idle, jump, keys, selected, settle, state, writeReport } from "./helpers";
import { autoLayout, command, idle, jump, keys, selected, settle, state, writeReport } from "./helpers";
const body = (page: Page) => state(page, (s) => s.snap.nodes[s.focus.node].body as string);
/** The links on the focused node: quote → target title (or node id). */
@@ -239,6 +239,7 @@ test("Tab then Enter on an article that is still loading go to its first link on
expect(await linksHere(page)).toEqual({ "Hoyle state": "Hoyle state" });
// The article takes a while to come (a slow network); the reader does not wait for it.
await page.route(/\/api\/wiki\/article\?title=Hoyle/, async (r) => {
await autoLayout(page);
await new Promise((done) => setTimeout(done, 1500));
await r.continue();
});
+2 -1
View File
@@ -6,7 +6,7 @@
* store call to the painted frame. Runs last: it fills the shared library.
*/
import { expect, test, type Page } from "@playwright/test";
import { idle, state, synced, writeReport, type Sample } from "./helpers";
import { autoLayout, idle, state, synced, writeReport, type Sample } from "./helpers";
const ready = (page: Page) => page.waitForFunction(() => (globalThis as any).__ie?.ready === true, undefined, { timeout: 30_000 });
/** One keystroke per frame, as in the other latency tests. */
@@ -98,6 +98,7 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
// ---- panes ----
await page.setViewportSize({ width: 1920, height: 1080 });
await autoLayout(page);
await page.goto("/");
await ready(page);
await expect(page.locator(".strip .pane")).toHaveCount(1);
+7 -1
View File
@@ -14,7 +14,13 @@ export default defineConfig({
timeout: 60_000,
workers: 1,
reporter: [["list"]],
use: { baseURL: `http://localhost:${PORT}`, viewport: { width: 1440, height: 900 } },
// The page starts in the column (`/view column`): auto would show panes at this width. A test of
// the panes view sets its own width and lets the layout follow it (helpers.ts `autoLayout`).
use: {
baseURL: `http://localhost:${PORT}`,
viewport: { width: 1440, height: 900 },
storageState: { cookies: [], origins: [{ origin: `http://localhost:${PORT}`, localStorage: [{ name: "ie:settings", value: JSON.stringify({ view: "column" }) }] }] },
},
webServer: {
// The production build with the deterministic mock model: what is measured is the app's
// own pipeline, not a model's speed.
+1 -1
View File
@@ -121,7 +121,7 @@ export const HELP: [string, [string, string][]][] = [
["/resolve", "have the model resolve open conflicts"],
["/auto on|off", "reconcile automatically after edits"],
["/speculate on|off", "start writing the focused sentence's expansion early"],
["/view mode", "page layout: auto, column or panes; auto shows panes on windows 1600 px wide or more"],
["/view mode", "page layout: auto, column or panes; auto shows panes on windows 900 px wide or more"],
["/curves on|off", "in panes: the faint curves from where each pane was opened to it"],
["/colors line|top|edge|off", "in panes: each fork's own colour, on its curves and the rule under its panes' titles (line, the default), across their tops, down their left edges, or none"],
["/user name", "set the name on your commits"],
+1 -1
View File
@@ -130,7 +130,7 @@ export type View = "auto" | "column" | "panes";
export type Colors = "line" | "top" | "edge" | "off";
const COLORS: Colors[] = ["line", "top", "edge", "off"];
/** The narrowest window, in CSS px, on which `auto` chooses panes. */
export const PANES_MIN_WIDTH = 1600;
export const PANES_MIN_WIDTH = 900;
/** Text being generated that is not in the document yet. */
export interface Pending {