Skip to content

fix(editor): delete untitled markdown files from disk when closed without edits - #821

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/md-file-fix
Apr 19, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/md-file-fix

Conversation

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Summary

  • Bug: Cmd+Shift+M creates an empty untitled-{x}.md on disk immediately (so the editor has a real path). Closing the tab without editing left the empty file behind as clutter.
  • Fix: closeFile() and closeAllFiles() now delete the on-disk file when the closed tab is untitled, not dirty, and has no editor draft.
  • Bonus: Excluded these throwaway files from the recently-closed stack so Cmd+Shift+T doesn't try to reopen a deleted path.

Test plan

  • Press Cmd+Shift+M to create a new markdown note, then close it immediately without typing — verify the untitled.md file does not persist in the worktree
  • Press Cmd+Shift+M, type some content, close the tab — verify the save/discard dialog appears and the file is preserved if saved
  • Press Cmd+Shift+M, type content, save with Cmd+S (rename dialog), then close — verify file persists under the new name
  • Create multiple untitled notes, close all tabs — verify none of the empty files remain on disk
  • Create an untitled note, close without editing, press Cmd+Shift+T — verify it does NOT reopen the deleted file
  • Run pnpm test — all 202 test files pass (2141 tests)

…hout edits

Cmd+Shift+M creates an empty untitled-{x}.md on disk eagerly so the
editor has a real path to bind to. If the user closes the tab without
typing anything, the file was left behind as clutter. Now closeFile()
and closeAllFiles() delete the on-disk file when the tab is untitled,
not dirty, and has no editor draft. These throwaway files are also
excluded from the recently-closed stack since reopening a deleted path
would fail.
@Jinwoo-H
Jinwoo-H merged commit 4bc0134 into main Apr 19, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…hout edits (stablyai#821)

Cmd+Shift+M creates an empty untitled-{x}.md on disk eagerly so the
editor has a real path to bind to. If the user closes the tab without
typing anything, the file was left behind as clutter. Now closeFile()
and closeAllFiles() delete the on-disk file when the tab is untitled,
not dirty, and has no editor draft. These throwaway files are also
excluded from the recently-closed stack since reopening a deleted path
would fail.
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.

1 participant