Add another session option that prevents saving (or loading) buffer contents #23108

Closed
opened 2026-01-31 08:32:37 +00:00 by claunia · 5 comments
Owner

Originally created by @Reddimes on GitHub (Apr 2, 2025).

Windows Terminal version

1.22.10731.0

Windows build number

10.0.26100

Other Software

No response

Steps to reproduce

Simply set the setting in Startup settings.
When Terminal Start: Open windows from a previous session

Image

Expected Behavior

One would expect this to recreate the same sessions you had open last time. You know, just fresh and clean new sessions like it used to. That is no longer the case.

Actual Behavior

This now saves the output from the last time the profile was open and makes everything look really messy and annoying. See attached screenshots.

The reason this is important to me is that I use Windows Terminal as a SSH Session Manager. I have a number of profiles available that simply launch an SSH session. Normally, it is not a huge deal for the SSH session to run in the background, but this makes it look ugly and disorganized.

Image
Image
Image

Originally created by @Reddimes on GitHub (Apr 2, 2025). ### Windows Terminal version 1.22.10731.0 ### Windows build number 10.0.26100 ### Other Software _No response_ ### Steps to reproduce Simply set the setting in Startup settings. `When Terminal Start: Open windows from a previous session` ![Image](https://github.com/user-attachments/assets/00f911a4-32ac-49c1-81be-cf2decb99bb9) ### Expected Behavior One would expect this to recreate the same sessions you had open last time. You know, just fresh and clean new sessions like it used to. That is no longer the case. ### Actual Behavior This now saves the output from the last time the profile was open and makes everything look really messy and annoying. See attached screenshots. The reason this is important to me is that I use Windows Terminal as a SSH Session Manager. I have a number of profiles available that simply launch an SSH session. Normally, it is not a huge deal for the SSH session to run in the background, but this makes it look ugly and disorganized. ![Image](https://github.com/user-attachments/assets/e8014c22-1144-4fa1-83a7-928b0f54cbde) ![Image](https://github.com/user-attachments/assets/8c95d6ea-75d6-4657-91d7-b646456dd070) ![Image](https://github.com/user-attachments/assets/d7f06803-e15b-49dc-84a5-26dac941aefc)
claunia added the Issue-TaskNeeds-Tag-FixProduct-TerminalPriority-2Area-Windowing labels 2026-01-31 08:32:37 +00:00
Author
Owner

@Reddimes commented on GitHub (Apr 3, 2025):

I tried editing permissions of %localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState to disallow creating new files. Then setting the permissions for elevated-state.json, state.json, and settings.json to allow modification. This does not fix the issue. It just ends the session entirely if I even try to save a setting change.

Edit:
I did go ahead and build a scheduled task to delete the buffer files in there every five minutes. I did disable it, because it is also annoying having a command prompt pop up every five minutes. I went ahead and completely removed write privileges for that directory(after "saving" a default state). I wish that it would still save what tabs I had open without doing any of the buffering, though. Am I missing a setting that will disable the buffer?

I checked the settings.json schema: https://aka.ms/terminal-profiles-schema and the help" https://aka.ms/terminal-documentation but could not find anything.

@Reddimes commented on GitHub (Apr 3, 2025): I tried editing permissions of `%localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState` to disallow creating new files. Then setting the permissions for `elevated-state.json`, `state.json`, and `settings.json` to allow modification. This does not fix the issue. It just ends the session entirely if I even try to save a setting change. Edit: I did go ahead and build a scheduled task to delete the buffer files in there every five minutes. I did disable it, because it is also annoying having a command prompt pop up every five minutes. I went ahead and completely removed write privileges for that directory(after "saving" a default state). I wish that it would still save what tabs I had open without doing any of the buffering, though. Am I missing a setting that will disable the buffer? I checked the settings.json schema: `https://aka.ms/terminal-profiles-schema` and the help" `https://aka.ms/terminal-documentation` but could not find anything.
Author
Owner

@Reddimes commented on GitHub (Apr 8, 2025):

Now that I've disabled permissions to prevent this issue, I get a notification every time I launch that says it is lacking permissions. Of course it is lacking permissions to fix the buffering bug. This terminal history needs to be disabled. I want the terminal to save what sessions I had open the last time I opened it, but not display any of the buffered text. That could potentially be a security issue for connecting to SSH servers.

@Reddimes commented on GitHub (Apr 8, 2025): Now that I've disabled permissions to prevent this issue, I get a notification every time I launch that says it is lacking permissions. Of course it is lacking permissions to fix the buffering bug. This terminal history needs to be disabled. I want the terminal to save what sessions I had open the last time I opened it, but not display any of the buffered text. That could potentially be a security issue for connecting to SSH servers.
Author
Owner

@DHowett commented on GitHub (Apr 9, 2025):

Thanks! Yes, this is definitely something we could do better.

We should introduce a third firstWindowPreference that affords for only restoring layouts (and no content.)


Beyond the main issue, your use case looks similar to #16303 (the ability to save and reload layouts). You may want to track that one as well.

@DHowett commented on GitHub (Apr 9, 2025): Thanks! Yes, this is definitely something we could do better. We should introduce a third `firstWindowPreference` that affords for only restoring layouts (and no content.) --- Beyond the main issue, your use case looks _similar_ to #16303 (the ability to save and reload layouts). You may want to track that one as well.
Author
Owner

@DHowett commented on GitHub (Apr 9, 2025):

FWIW, I am de-editorializing your title.

@DHowett commented on GitHub (Apr 9, 2025): FWIW, I am de-editorializing your title.
Author
Owner

@Reddimes commented on GitHub (Apr 9, 2025):

FWIW, I am de-editorializing your title.

Haha. That is totally fair, I let my emotions write that title. My mistake, I'll own that.

@Reddimes commented on GitHub (Apr 9, 2025): > FWIW, I am de-editorializing your title. Haha. That is totally fair, I let my emotions write that title. My mistake, I'll own that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23108