Skip to content

Undo close tab (Ctrl+Shift+T) reopens the last closed file tab where it was, with its undo #578

Closed

Description

@a-team-app

Context

Closing a tab by mistake means finding the file again and losing its undo history. This adds Undo close tab, which reopens the most recently closed file tab where it was, with its undo history, one press per tab, newest first. Pitch: #343 (see its Proposal, Mockup and Decided sections).

Acceptance criteria

  • With a file tab closed by Ctrl+W, pressing Ctrl+Shift+T reopens it as the active tab, in the same editor group and at the same place in the tab strip, with the cursor and scroll where they were.
  • After reopening, Ctrl+Z undoes the edits made before the tab was closed, and redo works too, provided the file on disk wasn't changed in between.
  • If the file changed on disk while closed (edited elsewhere, or closed dirty with Don't save), it reopens showing what's on disk, and Ctrl+Z has nothing to undo.
  • Pressing Ctrl+Shift+T again reopens the next most recently closed tab. After Close other tabs or Close all tabs, repeated presses bring each closed tab back one by one.
  • Closing a tab with the close button on the tab itself counts too.
  • It works with no tab open at all (e.g. after closing the last one).
  • A file that's been deleted since it was closed is skipped, and the next one reopens.
  • When nothing can be reopened (all already open again, deleted, or nothing closed yet), Undo close tab is dimmed in the File menu and the command palette.
  • The File menu shows Undo close tab Ctrl+Shift+T after Close all tabs, with u as its hot key.
  • The palette finds it by typing reopen or undo close, and by its mnemonic uct.
  • F1 in the editor lists Ctrl+Shift+T Undo close tab in the Tabs column.
  • Diff, file-history, review and document tabs are not reopened by it.
  • After switching folders or restarting, the list of closed tabs starts empty.

Tests

  • Closed-tab list: newest first, capped at 20, skips files already open and deleted ones, cleared on folder switch.
  • Reopen restores group (falling back to the first group when that one is gone) and tab index.
  • Undo history kept only when the file's contents on disk still match what the tab held at close; fresh history otherwise.
  • Close other / close all push every closed file tab; non-file tabs are never pushed.
  • Command enabled state follows whether anything is reopenable.
  • Key, mnemonic, menu letter and F1 row are registered.

Out of scope

  • A picker of recently closed files.
  • Remembering closed tabs across a restart or a folder switch.
  • Reopening diff, file-history, review or document tabs.
  • Persisting undo history to disk, or changing how undo works for open tabs.
  • Changing Back (Ctrl+G P).

Activity

  1. a-team-app commented on Oct 20, 2026

    @a-team-app
    ContributorAuthor

    Draft PR #580 is up.

  2. added 2 commits that reference this issue on Oct 20, 2026
    5a0138d
    1ea30a7
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

    a-team:devClaimed by the a-team Dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions