Skip to content

Creating a new file while current file is unsaved loses content #3232

Closed

Description

@jonathanturcotte

Description

Creating a new file when the current file is unsaved will create the new file and switch to that tab, but when you switch back all the content in the other tab is now lost.

  • Can you reproduce the issue?

Steps to reproduce

  1. Create a file, type some content but do not save
  2. Create another new file (I did this by right clicking on the sidebar and hitting New File)
  3. Observe that the new file is opened in a tab and you're automatically switched to that tab
  4. Click back to your old document and you've lost all your unsaved content.

Expected behavior:

My unsaved content should still be there.

Actual behavior:

My unsaved content is lost.

Versions

  • MarkText version: 0.17.1
  • Operating system: macOs 12.3

Activity

  1. added
    🐛 bug
    🐞 pri/critical
    on May 16, 2026
  2. Jocs commented on Jun 26, 2026

    @Jocs
    Member

    The underlying engine race (a same-frame document swap applying the outgoing document's pending op, which wedged the flush pipeline and dropped edits) was fixed in #2938 (#4658): setContent now cancels the pending deferred-flush and clears the operation cache, and the desktop flushes the active editor before switching tabs. Verified on the current build — typing in an unsaved tab, opening a new file, and switching back keeps the content. Closing as resolved; please reopen if you still see it on a recent build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bug🐞 pri/critical🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions