Repository navigation
feat: open several documents as tabs in a window - #688
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A window held one document, so opening another file replaced it after asking about unsaved changes. A window now holds several documents as tabs, under the ownership model in the #633 Outcome, and switching between them keeps each one's editor state. With one tab, everything behaves as before except that opening no longer replaces the document.
Newadds an untitled tab, numbered from the lowest free number. Opening never replaces a document, so it no longer asks about unsaved changes.activeDocumentas a mirror of the active tab for consumers that only follow it. Async workflows check a tab ID plus a generation that every document replacement bumps, so a read, save, reload, or prompt that settles after its tab closed or changed does nothing. Save and Save As target the tab that was active when the command was given, not whichever tab is active when a queued save runs.Close document(Mod+W), a tab's close button, and a middle click close one tab, asking about its unsaved changes by name. Closing the window,Close folder, or deleting an entry that holds several unsaved tabs shows one dialog naming them, withDiscard allandCancel.Open folderkeeps the tabs and opens the index file as a tab.Save asonto a path open in another tab is refused. A rename in the navigator moves every tab under the renamed path, keeping unsaved changes.Replace allasks about each unsaved tab its plan includes, in tab order and without switching tabs.+button that runsNew. A tab shows the file name, adding the parent folder when names clash and the full path on hover; an unsaved tab shows a dot that becomes a close button on hover.Mod+Tab/Mod+Shift+TabandMod+PageDown/Mod+PageUpmove through the strip with wrap,Mod+1toMod+8pick a tab, andMod+9picks the last. The window title follows the active tab asname - Leafdown, which adds thecore:window:allow-set-titlepermission.Related Issue
Closes #641
Refs #639
Verification
sessionstore tests: opening places a tab after the active one or reuses the tab holding the path, closing activates the right neighbor or else the left, and replacing a document bumps its generation.openSession,documentWorkflows,unsavedChanges,externalChanges,useDocumentWatchers,folderEntryWorkflows,folderContextWorkflows,folderSearchWorkflows,folderReplaceWorkflows): opening into a new or existing tab, per-tab unsaved and external-change state including reloads of inactive tabs, closing a tab, the several-tab dialog,Open folderandClose folderwith tabs, theSave asrefusal, rename and delete across tabs, and folder search and replace over several tabs including inactive unsaved ones. A regression test saves the tab the command was given on while another tab is active by the time the queued save runs; it fails without the fix.documentEditorBridge: heading, search-match, and focus requests wait for their editor to be shown and are dropped when another is shown first.document-tabs,shell,app,useAppCommands, andviewtests: the strip's order, names that clash, switching, closing without switching, andNewbutton; the window title; the window-close dialog; and the tab shortcuts' routing and wrap.linkRust tests: a target in a folder reached through a symbolic link keeps the folder's spelling, which fails without the change. The command contract test that link and folder-scan paths agree now starts fromTEMPas the host spells it, an 8.3 short path on the Windows CI runner, instead of canonicalizing it first.pnpm check:frontendandpnpm check:backendpassed.Manually verified in headless Microsoft Edge 154 on Windows 11, the engine WebView2 uses, with the tab strip and real editors mounted on a temporary Vite page and driven over the DevTools protocol:
Ctrl+Tabreached the page and wrapped from the last tab to the first.Not verified: the desktop E2E suite and the new
document-tabsscenario locally, which CI runs; the tab shortcuts in the Tauri window itself.Notes
document-lifecycleandfolder-searchno longer test the replace-on-open prompts this removes.