terminal icon indicating copy to clipboard operation
terminal copied to clipboard

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

Open Reddimes opened this issue 7 months ago • 5 comments

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

Reddimes avatar Apr 02 '25 22:04 Reddimes

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 avatar Apr 03 '25 00:04 Reddimes

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 avatar Apr 08 '25 00:04 Reddimes

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 avatar Apr 09 '25 21:04 DHowett

FWIW, I am de-editorializing your title.

DHowett avatar Apr 09 '25 21:04 DHowett

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 avatar Apr 09 '25 21:04 Reddimes