Repository navigation
Description
Summary
Allow users to drag a tab out of its current window to create a new window, and drag a tab onto another window’s tab bar to move it there. Keep the tab bar visible even when a window contains only one tab.
Problem it solves
I frequently need this functionality when working with multiple Markdown documents across multiple monitors.
These actions would make it easier to:
- Move a document into a separate window for reference or comparison.
- Bring documents back into the same window when separate windows are no longer needed.
- Reorganize documents without closing and reopening files or losing editing context.
Proposed solution
Basic interactions
-
Keep the tab bar visible.
Even when a new window contains only one tab, show both the tab bar and that tab so the user can drag it. -
Drag a tab out to create a new window.
Dragging a tab outside its current window and releasing it should move that document into a new MarkText window near the drop position. -
Drag a tab onto another window’s tab bar to move it there.
Dragging a tab from one MarkText window onto another window’s tab bar should move that tab into the destination window. Remove the source tab only after the transfer succeeds. Once all tabs have been moved out of the source window, it should return to its default blank-document state.
The destination tab bar could highlight when it can accept a drop and show the insertion position. Incoming tabs should retain their relative order.
Behavior and implementation considerations
The following are potential issues I have identified so far that may need additional consideration.
1. Preserve document state
Moving a tab should preserve its unsaved content, undo/redo history, scroll position, and editing mode. New untitled documents should also be transferable without requiring the user to save them first.
2. Handle files with the same name and duplicate documents
Documents with the same filename but different paths should remain separate tabs. A parent-folder label or full-path tooltip could help distinguish them.
If the destination window already has the same file open, with the same name and location:
- If neither copy has unsaved changes, block the transfer and prompt the user to save or synchronize the documents.
- If either copy has unsaved changes, the operation must not silently overwrite or discard either version. MarkText could ask the user which version to keep.
- Separate untitled documents should remain independent, even if they have the same display name.
3. Make transfers safe and recoverable
Remove the source tab only after the destination window confirms that it has received the document state and that the transfer has succeeded.
If the transfer fails or is cancelled, the document should remain available in the source window. A two-step prepare/confirm process might help prevent data loss caused by partial failures.
4. Account for window settings and workspaces
Moving tabs between windows may bring together documents from different workspace roots. I am unsure whether two windows can have different base-directory settings. If this is possible, the behavior needs to be defined so that relative image paths, file links, and save locations continue to resolve correctly.
5. Provide clear feedback and prevent accidental actions
A minimum drag distance or a hover delay before accepting a transfer could help prevent accidental detaching or moving. Pressing Escape should cancel the operation.
If a drop does not result in a valid transfer, the source window should remain intact.
6. Consider platform limitations
I only use MarkText on Windows, so I am unfamiliar with how windows and tabs should behave on macOS or Linux.
Alternatives considered [optional]
If this drag-and-drop interaction cannot be supported on other platforms, each tab’s context menu could provide “Move Tab to Window…” and “Move Tab to New Window” actions. These actions could also be exposed for keyboard access and accessibility.
Additional context [optional]
These are my current ideas and considerations. I intend to try implementing this myself, but before starting, I would appreciate feedback from the maintainers on the interaction design, platform limitations, and handling of duplicate documents, particularly anything I may have overlooked.
Activity
fix(desktop): detach tabs dropped outside any tab strip
feat(desktop): preview detached tab window bounds
fix(muya): retain valid selection toolbar coordinates across renders
test: align restored tab bar expectation with marktext#6112
fix(desktop): preserve document structure during tab transfers
feat: marktext#6112 show the tab bar by default
feat(desktop): marktext#6112 support safe tab transfers between windows
fix(desktop): marktext#6112 shorten tab transfer conflict notifications
fix(desktop): marktext#6112 detach tabs dropped outside any tab strip
feat(desktop): marktext#6112 preview detached tab window bounds
fix(muya): marktext#6112 retain valid selection toolbar coordinates a…
test: marktext#6112 align restored tab bar expectation
fix(desktop): marktext#6112 preserve document structure during tab tr…
chore: marktext#6112 merge origin/develop into feat/6112-tab-window-t…
fix(desktop): marktext#6112 align detached window creation with previ…
test(desktop): marktext#6112 isolate Wayland and non-Wayland tab drag…
feat(desktop): marktext#6112 make closing windows after last tab deta…