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 enter to restart the first pane in a split #16001

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

zadjii-msft
Copy link
Member

I noticed this last week, but forgot to file. If you have a pair of splits, and exit -1 the first, you can't use enter to restart it.

This PR fixes that. Basically, TerminalPage registers it's _restartPaneConnection handler when it makes a new Pane object. It registers the callback straight to the Pane. However, when a Pane gets split, it makes a new Pane object, and moves the original content into the new pane. TerminalPage however, would never hook up its own callback to that newly created pane.

This fixes that.

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Sep 19, 2023
@zadjii-msft zadjii-msft added this to the Terminal v1.19 milestone Sep 19, 2023
@@ -544,6 +544,8 @@ namespace winrt::TerminalApp::implementation
// possible that the focus events won't propagate immediately. Updating
// the focus here will give the same effect though.
_UpdateActivePane(newPane);

return { original, newPane };
Copy link
Member

Choose a reason for hiding this comment

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

Nothing uses the newPane tuple value. Do we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but I included it for parity with Pane::Split. Seemed to me like they should return the same thing

@DHowett DHowett merged commit 9b986a1 into main Sep 20, 2023
17 checks passed
@DHowett DHowett deleted the dev/migrie/b/restart-the-first-pane branch September 20, 2023 16:46
DHowett pushed a commit that referenced this pull request Sep 22, 2023
I noticed this last week, but forgot to file. If you have a pair of
splits, and `exit -1` the first, you can't use `enter` to restart it.

This PR fixes that. Basically, `TerminalPage` registers it's
`_restartPaneConnection` handler when it makes a new `Pane` object. It
registers the callback straight to the `Pane`. However, when a `Pane`
gets split, it makes a _new_ `Pane` object, and moves the original
content into the new pane. `TerminalPage` however, would never hook up
its own callback to that newly created pane.

This fixes that.

(cherry picked from commit 9b986a1)
Service-Card-Id: 90584595
Service-Version: 1.18
zadjii-msft added a commit that referenced this pull request Mar 26, 2024
Instead of `Pane` hosting a `TermControl` directly, it now hosts an
`IPaneContent`. This is an abstraction between the TermControl and the
pane itself, to allow for arbitrary implementations of `IPaneContent`,
with things that might not be terminals.

## References and Relevant Issues

* #997
* #1000

## Detailed Description of the Pull Request / Additional comments

This PR by itself doesn't do much. It's just a refactoring. 
- It doesn't actually add any other types of pane content. 
- It overall just tries to move code whenever possible, with as little
refactoring as possible. There are some patterns from before that don't
super scale well to other types of pane content (think: the `xyzChanged`
events on `IPaneContent`).
- There's a few remaining places where Pane is explicitly checking if
its content is a terminal. We probably shouldn't, but meh

There are two follow-up PRs to this PR:
* #16171 
* #16172 

In addition, there's more work to be done after these merge:
* TODO! issue number for "Replace `IPaneContent::xyzChanged` with
`PropertyChanged` events"
* TODO! issue number for "Re-write state restoration so panes don't
produce `NewTerminalArgs`"

## Validation Steps Performed

* It still launches
* It still works
* Broadcasting still works
* The weird restart connection thing from #16001 still works

## PR Checklist
- [x] Closes #997


## other PRs
* #16170 <-- you are here 
* #16171
* #16172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
Development

Successfully merging this pull request may close these issues.

3 participants