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

Closed
opened 2026-01-31 02:11:28 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (Aug 7, 2020).

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.

Originally created by @zadjii-msft on GitHub (Aug 7, 2020). From discussion in #6989 > move focus: > * or switch panes but make that other pane be zoomed in? <hr> 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 ```c++ 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.
Author
Owner

@carlos-zamora commented on GitHub (Aug 7, 2020):

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

@carlos-zamora commented on GitHub (Aug 7, 2020): > 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
Author
Owner

@ghost commented on GitHub (Oct 20, 2021):

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

Handy links:

@ghost commented on GitHub (Oct 20, 2021): :tada:This issue was addressed in #11046, which has now been successfully released as `Windows Terminal Preview v1.12.2922.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.12.2922.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10059