From 61976191d0f96626bb6d48555d07e4ce9a683243 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Tue, 10 Nov 2026 06:40:44 -0700 Subject: [PATCH] Show different tabs side by side in split view Each tab menu has "Open to the right". It shows the tab in a new pane to the right of the active pane. A pane shows a document or a plugin tab, for example a browser tab. - A plugin view stays in the plugin layer above the panes, so a move between panes does not mount it again. - A browser tab that covers the area moves to the left pane when a tab opens beside it. The last pane gives its plugin tab the whole area. - The "Split" toggle of a document is now "Read beside". Card 565874b2. --- docs/design-decisions.md | 17 +++ docs/guides/document-tools.md | 6 +- docs/ui-design.md | 2 +- docs/user-guide.md | 16 ++- src/lib/i18n/messages.ts | 10 +- src/lib/layout/DocumentArea.svelte | 110 ++++++++++++------ src/lib/layout/EditorPane.svelte | 4 +- src/lib/layout/ViewModes.svelte | 8 +- src/lib/layout/Workbench.svelte | 109 ++++++++++++++--- src/lib/workspace/documentPanes.ts | 96 +++++++++++---- src/lib/workspace/splitLayout.ts | 14 +++ tests/smoke/_harness/index.mjs | 4 +- .../appearance/backgroundFrames.smoke.mjs | 4 +- tests/smoke/find/typing.smoke.mjs | 2 +- tests/smoke/layout/mixedSplits.smoke.mjs | 106 +++++++++++++++++ tests/smoke/layout/viewModes.smoke.mjs | 12 +- tests/smoke/layout/workbench.smoke.mjs | 6 +- tests/smoke/links/sectionLinks.smoke.mjs | 4 +- tests/smoke/tables/formulas.smoke.mjs | 4 +- tests/smoke/tabs/menus.smoke.mjs | 6 +- tests/smoke/tabs/scroll.smoke.mjs | 4 +- tests/unit/layout/documentPanes.spec.ts | 45 ++++++- 22 files changed, 473 insertions(+), 116 deletions(-) create mode 100644 tests/smoke/layout/mixedSplits.smoke.mjs diff --git a/docs/design-decisions.md b/docs/design-decisions.md index 27dfbc7..d847ffc 100644 --- a/docs/design-decisions.md +++ b/docs/design-decisions.md @@ -1155,3 +1155,20 @@ Update 2026-10-29: The native Terminal feature keeps the 65% cap on `--rs-select - Evidence: `tests/smoke/features/pdf.smoke.mjs` and `tests/unit/features/pdf.spec.ts`. - Replaces / replaced by: The one-page rule and the zoom text of [UI-059](#ui-059--the-pdf-toolbar-on-shared-controls). - Limits: Only the pages near the visible area have a drawing. Until the viewer reads the size of a page, the page has the size of the first page. Browser checks use desktop service mocks. Native desktop acceptance remains open. + +### UI-064 — Split view shows different tabs + +- Type: Rule change +- Date: 2026-11-10 +- Status: Implemented for user review +- Decision source: Card 565874b2 reports that split view shows only the same document side by side. The user expects different documents side by side, also with a web browser. +- Previous rule: [UI-021](#ui-021--workspace-links-in-document-panes). Only a file tree item or a workspace link opened a document to the right. Document panes held only documents. A plugin tab, for example a browser tab, covered the whole document area. The **Split** toggle showed Read beside the editor of the same document. +- New rule: Each tab menu has **Open to the right**. It shows the tab in a new pane to the right of the active pane. A pane shows a document or a plugin tab. A tab shows in one pane at most, so the item is unavailable for a visible tab. A tab that the user selects, or a file that the user opens, replaces the content of the active pane. The replaced tab stays open. A plugin tab that covers the area moves to the active pane when a tab opens beside it. When one pane is left, its plugin tab covers the area again. A plugin pane has a bar with its title and **Close split**. A document pane beside other panes shows the full path in its bar. The **Split** toggle is now **Read beside**. +- Reason: "Split" named two different things. Users compare a note with a different note or with a web page. +- Scope: Document panes, plugin editor tabs, the tab menu, and the view control. +- Shared implementation: `src/lib/workspace/documentPanes.ts`, `src/lib/workspace/splitLayout.ts` (`stackLayout`, `splitSibling`), `src/lib/layout/DocumentArea.svelte`, and `src/lib/layout/Workbench.svelte`. A plugin view stays in the plugin layer above the panes, so a move between panes does not mount it again. +- Exceptions: **Split right** and **Split down** in the menu of a browser tab still open a copy of the page. In a pane, the copy opens beside that pane. +- Narrow layout: An area of 640 pixels or less shows the panes one above the other, in the same order. The area does not scroll. Each pane keeps its own scroll bar. +- Evidence: `tests/smoke/layout/mixedSplits.smoke.mjs`, `tests/smoke/layout/splits.smoke.mjs`, and `tests/unit/layout/documentPanes.spec.ts`. +- Replaces / replaced by: The document-only panes of [UI-021](#ui-021--workspace-links-in-document-panes), and the name **Split** of [UI-049](#ui-049--one-view-control-and-one-file-name). +- Limits: Panes have equal sizes. A drag cannot move a tab into a pane. Browser checks use desktop service mocks. Native desktop acceptance remains open. diff --git a/docs/guides/document-tools.md b/docs/guides/document-tools.md index b47e90c..c41b67f 100644 --- a/docs/guides/document-tools.md +++ b/docs/guides/document-tools.md @@ -24,11 +24,11 @@ Select an image, then right-click it or press Shift+F10 for these actions: - **Copy path** and **Show in Explorer**, for workspace images **Remove image**, or the Delete key, removes the image link from the note. It does not delete the file. Undo restores the link. -Zoom works in Write, Read, and Split. It can fit the image or magnify it. Press Escape to close it. +Zoom works in Write, Read, and Read beside. It can fit the image or magnify it. Press Escape to close it. ## Read diagrams and document properties -Write, Read, and Split show wiki links, note callouts, and Mermaid diagrams. +Write, Read, and Read beside show wiki links, note callouts, and Mermaid diagrams. RuneStone renders Mermaid diagrams locally. If a diagram is not valid, RuneStone shows an error message and the diagram source. Read shows frontmatter in a collapsed **Properties** section. @@ -97,7 +97,7 @@ Start a cell with `=` to make a formula. Columns use letters A, B, … AA. Row 1 | Functions | SUM, AVERAGE, MIN, MAX, COUNT, ABS, and ROUND | Functions that take a range ignore text and blank cells. Arithmetic uses zero for a blank cell. -Results update in Write, Read, and Split. Select a result to edit its formula. Enter saves the formula, and Tab moves to the next cell. +Results update in Write, Read, and Read beside. Select a result to edit its formula. Enter saves the formula, and Tab moves to the next cell. The **Formulas** control below each table explains the syntax. The active cell shows its address. A formula that is not valid, a missing cell, or a circular reference shows an error label. diff --git a/docs/ui-design.md b/docs/ui-design.md index aeedefb..f0cf8ad 100644 --- a/docs/ui-design.md +++ b/docs/ui-design.md @@ -222,7 +222,7 @@ Decisions: [UI-009](design-decisions.md#ui-009--character-theme-appearances), [U - The app image fills the work area below the titlebar, including new tabs and document views. It stays fixed while content scrolls. - Sidebars use `--rs-image-sidebar-bg` (82% tint). Editor surfaces use `--rs-image-editor-bg` (90% tint). Without an image, both are opaque. -- Write, Source, Read, and Split share the editor surface. CodeMirror layers stay transparent above it. +- Write, Source, Read, and Read beside share the editor surface. CodeMirror layers stay transparent above it. - Code blocks in Write and Read use `--rs-code-block-bg`. - Hovered rows and controls in the work area, hovered menu rows, and the workspace button use `--rs-hover-bg`. With an image, it is a 6% veil of the strong text color. The image stays visible, and the hover shows over light and dark image areas. Dialogs and Settings keep opaque fills. - New-tab buttons use `--rs-image-control-bg` and `--rs-image-control-hover-bg`. Their tint keeps labels readable while the image stays visible. The new-tab screen shows only its action buttons, with icons, labels, and shortcuts. diff --git a/docs/user-guide.md b/docs/user-guide.md index 414859f..1fa81cf 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -75,14 +75,14 @@ On macOS and Linux, you can still open, edit, rename, and delete existing files ## Edit documents -Each document pane has one view control with three choices, and a **Split** button: +Each document pane has one view control with three choices, and a **Read beside** button: | Choice | Shows | | --- | --- | | **Write** | Formatted Markdown. The active line shows its Markdown source. | | **Source** | The plain source with line numbers and syntax colors | | **Read** | The rendered document, without editing. Markdown files only. | -| **Split** | Read beside Write or Source. Narrow panes stack the two views. Select **Split** again to close it. Markdown files only. | +| **Read beside** | Read beside Write or Source. Narrow panes stack the two views. Select **Read beside** again to close it. Markdown files only. | Press Ctrl+E to switch between Write and Source. Press Ctrl+Shift+E to switch between Read and the editor. The tab menu has the same choices under **View**. The control shows icons only. Hover over an icon, or focus it with the keyboard, to see its name and shortcut. The arrow keys move the choice. @@ -184,6 +184,18 @@ If the move fails, the source tab stays open. When you start RuneStone again, it opens the document tabs of the workspace. It keeps their order, pins, and active tab. This includes PDF tabs and plugin tabs that show a file. RuneStone reads the contents again from disk. Missing files do not stop the other tabs from opening. +### Show tabs side by side + +1. Right-click a tab that is not visible. +2. Select **Open to the right**. + +The tab opens in a new pane to the right of the active pane. A pane shows a document or a plugin tab, for example a browser tab. A tab shows in one pane at a time. + +- Click a pane to make its tab the active tab. A tab that you select, or a file that you open, replaces the content of the active pane. The replaced tab stays open. +- A pane beside other panes names its file in the bar above the document. Select **Close split** in that bar to close the pane. The tab stays open. +- A browser tab that fills the area moves to the left pane when a tab opens to the right. When one pane is left, its browser tab fills the area again. +- The file menu of the file tree and the link menu also have **Open to the right**. In a narrow window, the panes show one above the other. + ## Save your work Auto-save is on by default. It saves changed files every 5 seconds, also in background tabs. RuneStone does not write unchanged files. diff --git a/src/lib/i18n/messages.ts b/src/lib/i18n/messages.ts index a1b249a..346d520 100644 --- a/src/lib/i18n/messages.ts +++ b/src/lib/i18n/messages.ts @@ -1020,10 +1020,10 @@ export const messageRows: [string, string, string, string][] = [ "阅读" ], [ - "Split", - "Diviser", - "分割", - "分栏" + "Read beside", + "Lire à côté", + "横に閲覧", + "并排阅读" ], [ "Editor", @@ -3376,7 +3376,7 @@ export const messageRows: [string, string, string, string][] = [ ["Show the file name above each Markdown note in Write and Read.", "Afficher le nom du fichier au-dessus de chaque note Markdown dans Écrire et Lire.", "「書く」と「閲覧」で、各 Markdown ノートの上にファイル名を表示します。", "在“写作”和“阅读”中,在每篇 Markdown 笔记上方显示文件名。"], ["Source", "Source", "ソース", "源码"], ["View", "Affichage", "表示", "视图"], - ["Split: Read beside the editor", "Diviser : Lire à côté de l’éditeur", "分割: エディターの横に閲覧を表示", "分栏:在编辑器旁显示阅读"], + ["Read beside: show the Read view beside the editor", "Lire à côté : afficher Lire à côté de l’éditeur", "横に閲覧: エディターの横に閲覧を表示", "并排阅读:在编辑器旁显示阅读"], ["Switch between Write and Source", "Alterner entre Écrire et Source", "「書く」と「ソース」を切り替え", "在写作和源码之间切换"], ["Switch between Read and the editor", "Alterner entre Lire et l’éditeur", "「閲覧」とエディターを切り替え", "在阅读和编辑器之间切换"], ["Unsaved", "Non enregistré", "未保存", "未保存"], diff --git a/src/lib/layout/DocumentArea.svelte b/src/lib/layout/DocumentArea.svelte index a45f455..a6994cd 100644 --- a/src/lib/layout/DocumentArea.svelte +++ b/src/lib/layout/DocumentArea.svelte @@ -1,26 +1,32 @@ -
-
- {#each $pluginEditors as pane (pane.key)} - {@const bounds = pluginBounds[pane.key]} - -
{ if ($pluginView?.key !== pane.key) selectPluginEditor(pane); }} - onpointerdown={() => { if ($pluginView?.key !== pane.key) selectPluginEditor(pane); }}> - {#if split && bounds} - tab.id === pane.key)} /> - {/if} - -
- {/each} -
-
-
1}> +
+
+
{#each documentViews as pane (pane.id)} + {@const box = bounds[pane.id]} -
0} class:edge-top={(box?.top ?? 0) > 0} data-document-pane={pane.id} data-document-path={pane.buffer?.relPath ?? ""} - style:--pane-weight={pane.bounds.width} + style:left={`${box?.left ?? 0}%`} style:top={`${box?.top ?? 0}%`} + style:width={`${box?.width ?? 100}%`} style:height={`${box?.height ?? 100}%`} onpointerdowncapture={() => onFocusPane(pane.id)} onfocusin={() => onFocusPane(pane.id)}> + + {#if !pane.pluginKey} {#if pane.buffer?.diskError} {:else if pane.buffer?.diskContents != null} @@ -94,7 +99,7 @@ bind:this={paneComponents[pane.id]} {tabs} active={activePane === pane.id} - onCloseSplit={documentViews.length > 1 ? () => onCloseSplit(pane.id) : undefined} + onCloseSplit={several ? () => onCloseSplit(pane.id) : undefined} {hasWorkspace} {onOpenWorkspace} {onNewFile} @@ -117,10 +122,36 @@ onCursor={(line, column) => onCursor(pane, line, column)} onOpenLink={(kind, target) => onOpenLink(pane, kind, target)} /> + {/if}
{/each}
+
+ {#each $pluginEditors as view (view.key)} + {@const host = pluginCover ? undefined : hosts.get(view.key)} + {@const box = pluginCover ? pluginBounds[view.key] : host ? bounds[host] : undefined} + +
0} class:edge-top={!!host && (box?.top ?? 0) > 0} + data-plugin-pane={view.key} + style:left={`${box?.left ?? 0}%`} style:top={`${box?.top ?? 0}%`} + style:width={`${box?.width ?? 100}%`} style:height={`${box?.height ?? 100}%`} + onfocusin={() => focusPlugin(view, host)} + onpointerdowncapture={() => focusPlugin(view, host)}> + {#if pluginCover && split && box} + tab.id === view.key)} /> + {:else if host && several} +
+ {view.title} + onCloseSplit(host)} /> +
+ {/if} + +
+ {/each} +
diff --git a/src/lib/layout/EditorPane.svelte b/src/lib/layout/EditorPane.svelte index 2e308be..ab74fc2 100644 --- a/src/lib/layout/EditorPane.svelte +++ b/src/lib/layout/EditorPane.svelte @@ -147,7 +147,9 @@ const splitView = $derived(split && canPreview && !reading); const view: ViewMode = $derived(readOnly ? "read" : chrome === "Source" ? "source" : "write"); // The tab already names the file, so the breadcrumb shows only its folder. - const folder = $derived(buffer?.relPath.includes("/") ? buffer.relPath.slice(0, buffer.relPath.lastIndexOf("/")).split("/").join(" / ") : ""); + // Beside other panes, the breadcrumb also names the file, because the tab bar names only the file of the active pane. + const folder = $derived(!buffer ? "" : onCloseSplit ? buffer.relPath.split("/").join(" / ") + : buffer.relPath.includes("/") ? buffer.relPath.slice(0, buffer.relPath.lastIndexOf("/")).split("/").join(" / ") : ""); {#if !buffer || buffer.kind === "empty"} diff --git a/src/lib/layout/ViewModes.svelte b/src/lib/layout/ViewModes.svelte index 1a34d23..a679f51 100644 --- a/src/lib/layout/ViewModes.svelte +++ b/src/lib/layout/ViewModes.svelte @@ -1,10 +1,10 @@