microsoft / microsoft/terminal

megathread: Window State Persistence

Open
#9,800 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Remoting Issue-Scenario Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

[Original thread: #766] [Spec: {none}] [Initial PR: #10972] [Multiple windows PR: #11083]

This thread is being used to track all the component work for restoring the window state. Additionally related threads:

  • #766 - Restore the layout, position of windows
    • This is partially implemented in #10972
    • #11083 handles this for multiple windows.
  • #961 - Restore the contents of the buffer when resuming a tab.
    • This is not about restoring the process state entirely, since that's impossible. Simply the text content is good enough.
    • Stashing this in JSON doesn't really make sense - imagine SHRT_MAX lines of text + attributes in a json string.
  • #960 - Re-open a recently closed tab
    • This means we shouldn't just discard the terminal control when closing a pane/tab. This is similar to the ctrl+shift+t shortcut in (Chromium) browsers
    • Likely best to wait for #1256 and #5000 to sort themselves out before starting this one.
  • #8841 and #8812 need to merge, so we can properly reflect all these options in the SUI.
  • #11081
  • #6362
Settings UI Mockup (programmer art warning)

mockup

2.0 Bugs

these are all presuming that #10972 merges basically as is

  • We should wrap this feature up in a Preview-only feature flag (no external community member should have to deal with that)
  • Opening an elevated window will automatically re-open all the unelevated window state (as elevated!). This is because there are separate monarchs for elevated and unelevated windows.
  • How do we persist something like wt -- cmd.exe? That won't have a profile, only a NewTerminalArgs, that we don't cache at runtime
    • We've mentioned in team syncs before that we may need to keep the NewTerminalArgs around when spawning a
  • Same idea with a defterm connection - We won't be able to restore defterm panes at all, because we have no idea what profile they were. Right?
  • How exactly does this work with the _quake window? Should that participate in the session restore? Probably, yea.
  • Window names need to be persisted as well.
  • Closing the last window with ClosePane will clear out any persisted layout.
    • This is by design
  • Similarly with closing the last tab by clicking the x on the tab itself. Doesn't seem to save the window layout in that case.
    • This is by design
  • If you have a profile with a background, then the colorscheme will blow away the profile's background on restore.
    • fixed in #11083
  • Terminal doesn't remember maximized, focus, fullscreen states #11426
  • #11639
  • #11878
  • #18670
  • #12902
  • #12633
  • The size of a focus mode window is wrong after a session restore. I believe this is actually the same root cause as:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This is a tracking megathread rather than a standalone task; start by reading the original thread #766 and the referenced PRs #10972 and #11083. Review the unchecked items and related issues to identify a specific unresolved component, with completion defined by resolving that scoped item rather than the entire window-state persistence effort.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, desktop, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.