fix(desktop): open Quick Open when files are open without a folder by Dev-next-gen · Pull Request #5431 · marktext/marktext · GitHub
Skip to content

fix(desktop): open Quick Open when files are open without a folder - #5431

Merged
Jocs merged 1 commit into
marktext:developfrom
Dev-next-gen:fix/quick-open-without-folder
Sep 17, 2026
Merged

Jocs merged 1 commit into
marktext:developfrom
Dev-next-gen:fix/quick-open-without-folder

Conversation

@Dev-next-gen

Copy link
Copy Markdown
Contributor

Fixes #5430

Summary

With a file open and no folder, Quick Open (Ctrl+P) never showed the palette. QuickOpenCommand.run() lets that state through on purpose (it only gives up when there is neither a folder nor a tab), then lists the open tabs through _getPath(), which read this._folderState.projectTree!.pathname. projectTree is null in that state, so run() rejected with a TypeError and handleShow only logged it.

_getPath() now treats a missing folder like a file outside the folder and returns the full path as title and description, which is what it already did for files outside the opened folder. Nothing changes when a folder is open. _doSearch() already handled the no-folder case on its own, so run() was the only path that failed.

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)
  • Manually tested on:

packages/desktop/test/unit/specs/quick-open-without-folder.spec.ts calls run() with one open tab (plus an untitled one), first with no folder and then with a folder that contains the file. On develop (73b90a7) the no-folder case fails with promise rejected "TypeError: Cannot read properties of null…" instead of resolving, thrown at quickOpen.ts:216. With the fix both tests pass. The whole desktop unit suite passes (60 files, 820 tests), vue-tsc --noEmit is clean, and eslint reports no errors on the two files. I ran this on Linux under vitest and did not try the shortcut in a built app.

Notes for reviewers [optional]

The same file builds the tab filter RegExp from a SPECIAL_CHARS class that leaves out { and }, like the Find escaping fixed in #5428. I kept that out of this PR.


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

Found by a defect-hunting pipeline I build and run (Dev-next-gen), using Claude Code with Anthropic's Claude Opus 5.

@Jocs
Jocs merged commit 5f23276 into marktext:develop Sep 17, 2026
9 checks passed
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.

[Bug] Quick Open does nothing when files are open without a folder

2 participants