Skip to content

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

@zadjii-msft

Description

@zadjii-msft

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-UserInterfaceIssues pertaining to the user interface of the Console or TerminalHelp WantedWe encourage anyone to jump in on these.Issue-TaskIt's a feature request, but it doesn't really need a major design.Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions