Skip to content

feat(desktop): add preview tabs for sidebar files (#2395) - #5820

Merged
Jocs merged 2 commits into
developfrom
feat/2395-preview-tabs
Oct 21, 2026
Merged

Jocs merged 2 commits into
developfrom
feat/2395-preview-tabs

Conversation

@Jocs

@Jocs Jocs commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Closes #2395

Summary

Add VS Code-style preview tabs for files opened from the sidebar:

  • Single-click opens or reuses one preview tab per window.
  • Replacing a preview keeps the tab position.
  • Editing or double-clicking pins the tab as a regular tab.
  • Sidebar request sequencing prevents stale asynchronous loads from winning during rapid selection.
  • Add the openFilesInPreviewMode preference, enabled by default and limited to the sidebar file tree.
  • Show preview state with italics and an accessible tab label.

Type of change

  • Bug fix (non-breaking, fixes an issue)
  • New feature (non-breaking, adds functionality)
  • Breaking change (causes existing functionality to change)
  • Documentation update

Test plan

  • New tests added (or explain why not needed)
    • Unit coverage for preview creation/replacement, pinning, stale requests, preference handling, and transient state.
    • Electron E2E coverage for reuse, editing, double-click, preference disable, hidden tab bar, and rapid clicks.
  • Manually tested on: macOS
  • pnpm run typecheck
  • pnpm run build:unpack
  • pnpm run test:unit (1164 tests passed)
  • pnpm -C packages/desktop exec playwright test test/e2e/issue-2395-preview-tabs.spec.ts test/e2e/sidebar-focus-model.spec.ts (13 tests passed)
  • pnpm run lint (0 errors; existing warnings only)
  • git diff --check

Notes for reviewers [optional]

  • Preview state is transient and intentionally excluded from the buffer store, so restored tabs open as regular tabs.
  • The preference only changes sidebar file-tree behavior; Quick Open, search results, and external file associations keep their current behavior.
  • A Keep Open context-menu action is intentionally out of scope for this PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@Jocs
Jocs requested a balanced review from Copilot October 21, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Build artifacts for PR #5820:

Run: https://github.com/marktext/marktext/actions/runs/39536495094

Artifact Size Link
marktext-macos-arm64 300.2 MB Download
marktext-macos-x64 313.5 MB Download
marktext-linux-x64 667.4 MB Download
marktext-linux-arm64 522.3 MB Download
marktext-windows-arm64 291.0 MB Download
marktext-windows-x64 299.1 MB Download

@Jocs
Jocs merged commit 9083162 into develop Oct 21, 2026
13 checks passed
@Jocs
Jocs deleted the feat/2395-preview-tabs branch October 23, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open file in same tab

2 participants