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

Moving focus with a zoomed pane should just zoom the adjacent pane #7215

Closed
zadjii-msft opened this issue Aug 7, 2020 · 2 comments · Fixed by #11046
Closed

Moving focus with a zoomed pane should just zoom the adjacent pane #7215

zadjii-msft opened this issue Aug 7, 2020 · 2 comments · Fixed by #11046
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@zadjii-msft
Copy link
Member

From discussion in #6989

move focus:

  • or switch panes but make that other pane be zoomed in?

Okay, this is not trivial. When we move the focus to another pane, it takes a dispatcher loop to be able to mark the newly-focused pane as the "active" one. So if we do it all in the moveFocus handler, then when we try to zoom in on the active pane, it's still technically the current pane, not the new one.

I got it to sorta work with

    void TerminalPage::_MoveFocus(const Direction& direction)
    {
        if (auto index{ _GetFocusedTabIndex() })
        {
            auto focusedTab{ _GetStrongTabImpl(*index) };
            const bool wasZoomed = focusedTab->IsZoomed();
            _UnZoomIfNeeded();
            focusedTab->NavigateFocus(direction);
            if (wasZoomed)
            {
                _tabView.Dispatcher().RunAsync(CoreDispatcherPriority::Low, [this, focusedTab]() {
                    focusedTab->ToggleZoom();

                    // Update the selected tab, to trigger us to re-add the tab's GetRootElement to the UI tree
                    _UpdatedSelectedTab(_tabView.SelectedIndex());
                });
            }
        }
    }

But that causes a frame where we re-attach the zoomed-out UI, then go back to the zoomed-in UI (zoomed to the new pane). Unfortunately, that forces 2 resizes (resize the current pane smaller, then resize the new pane bigger), and those resizes in debug are fairly laggy.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels Aug 7, 2020
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 7, 2020
@carlos-zamora
Copy link
Member

But that causes a frame where we re-attach the zoomed-out UI, then go back to the zoomed-in UI (zoomed to the new pane). Unfortunately, that forces 2 resizes (resize the current pane smaller, then resize the new pane bigger), and those resizes in debug are fairly laggy.

With the animation, I bet that would look really neat. And as long as the release build works fine, I think I'm ok with the perf impact. But that's just my 2 cents. :P

@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 10, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Aug 26, 2020
@ghost ghost added the In-PR This issue has a related PR label Aug 26, 2021
@ghost ghost closed this as completed in #11046 Sep 2, 2021
ghost pushed a commit that referenced this issue Sep 2, 2021
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
Make it so you can navigate pane focus without unzooming.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #7215
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
- Slight refactor to bring the MRU pane logic into the `NavigateDirection` function
- The actual zoom behavior was not a problem, the only issue is that because most of the panes weren't in the UI tree I had to disable using the actual sizes. There is nothing wrong with that, since the synthetic sizing is required anyways, but I'm curious what other peoples' thoughts are.

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

![output](https://user-images.githubusercontent.com/6185249/130901911-91676da2-db40-412d-b726-61a3f559ae17.gif)
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Sep 2, 2021
@ghost
Copy link

ghost commented Oct 20, 2021

🎉This issue was addressed in #11046, which has now been successfully released as Windows Terminal Preview v1.12.2922.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants