Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix persistence of handoff'd tabs #17268

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented May 14, 2024

As it turns out, for handoff'd connections Initialize isn't called
and this meant the _sessionId was always null.
After this PR we still don't have a _profileGuid but that's probably
not a critical issue, since that's an inherent flaw with handoff.
It can only be solved in a robust manner if WT gets launched before the
console app is launched, but it's unlikely for that to ever happen.

Validation Steps Performed

  • Launch
  • Register that version of WT as the default
  • Close all tabs (Ctrl+Shift+W)
  • persistedWindowLayouts is empty ✅
  • Launch cmd/pwsh via handoff
  • You get 1 window ✅
  • Close the window (= press the X button)
  • Launch
  • You get 2 windows ✅

@@ -180,12 +180,14 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
const HANDLE hRef,
const HANDLE hServerProcess,
const HANDLE hClientProcess,
TERMINAL_STARTUP_INFO startupInfo) :
const TERMINAL_STARTUP_INFO& startupInfo) :
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This is just a lil extra. Avoids a struct copy.)

@lhecker lhecker added this to To Cherry Pick in 1.20 Servicing Pipeline via automation May 14, 2024
@lhecker lhecker added this to To Cherry Pick in 1.21 Servicing Pipeline via automation May 14, 2024
lhecker added a commit that referenced this pull request May 14, 2024
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.20 Servicing Pipeline May 14, 2024
@DHowett DHowett enabled auto-merge May 15, 2024 19:18
@DHowett DHowett added this pull request to the merge queue May 15, 2024
Merged via the queue into main with commit 9054c81 May 15, 2024
20 checks passed
@DHowett DHowett deleted the dev/lhecker/17179-persistence branch May 15, 2024 22:34
lhecker added a commit that referenced this pull request May 16, 2024
As the title says, this backports the changes in #17211 and #17268:
* `PersistState` being called when the window is closed
  (as opposed to closing the tab). The settings check was missing.
* Avoid persisting windows with 0 tabs (= last tab gets closed).
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.21 Servicing Pipeline May 17, 2024
DHowett pushed a commit that referenced this pull request May 17, 2024
As it turns out, for handoff'd connections `Initialize` isn't called
and this meant the `_sessionId` was always null.
After this PR we still don't have a `_profileGuid` but that's probably
not a critical issue, since that's an inherent flaw with handoff.
It can only be solved in a robust manner if WT gets launched before the
console app is launched, but it's unlikely for that to ever happen.

## Validation Steps Performed
* Launch
* Register that version of WT as the default
* Close all tabs (Ctrl+Shift+W)
* `persistedWindowLayouts` is empty ✅
* Launch cmd/pwsh via handoff
* You get 1 window ✅
* Close the window (= press the X button)
* Launch
* You get 2 windows ✅

(cherry picked from commit 9054c81)
Service-Card-Id: 92556178
Service-Version: 1.21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants