Switching tab as part of running multiple actions does not focus tab immediately #15047

Closed
opened 2026-01-31 04:26:57 +00:00 by claunia · 1 comment
Owner

Originally created by @Rosefield on GitHub (Sep 1, 2021).

Windows Terminal version (or Windows build number)

dev/main, but also potentially preview through commandline

Other Software

No response

Steps to reproduce

Trying to use the multipleActions action with this command (trying to update the docs)

        { "name": "Create My Layout", "command": { 
            "action": "multipleActions",
            "actions": [
                // Create a new tab with 3 panes
                { "action": "newTab", "tabTitle": "Work", "colorScheme": "One Half Dark" },
                { "action": "splitPane", "split": "vertical", "profile": "Windows PowerShell", "tabTitle": "Work", "colorScheme": "Campbell Powershell", },
                { "action": "splitPane", "split": "horizontal", "profile": "Windows PowerShell", "tabTitle": "Work", "colorScheme": "Campbell Powershell", },
                // Create a second tab
                { "action": "newTab", "tabTitle": "Misc"},
                // Go back to the first tab and zoom the first pane
                { "action": "prevTab", "tabSwitcherMode": "disabled"},
                { "action": "moveFocus", "direction": "first"},
                "togglePaneZoom"
                ]
            }}

Results in not zooming or focusing the correct pane.

Expected Behavior

The first new tab will be focused, and the first pane on it should be zoomed.

Actual Behavior

The first new tab is focused, but the last created pane is focused and nothing is zoomed because the activeTab is still the 2nd tab even after prevTab is run until the event loop catches up.

Originally created by @Rosefield on GitHub (Sep 1, 2021). ### Windows Terminal version (or Windows build number) dev/main, but also potentially preview through commandline ### Other Software _No response_ ### Steps to reproduce Trying to use the `multipleActions` action with this command (trying to update the docs) ``` { "name": "Create My Layout", "command": { "action": "multipleActions", "actions": [ // Create a new tab with 3 panes { "action": "newTab", "tabTitle": "Work", "colorScheme": "One Half Dark" }, { "action": "splitPane", "split": "vertical", "profile": "Windows PowerShell", "tabTitle": "Work", "colorScheme": "Campbell Powershell", }, { "action": "splitPane", "split": "horizontal", "profile": "Windows PowerShell", "tabTitle": "Work", "colorScheme": "Campbell Powershell", }, // Create a second tab { "action": "newTab", "tabTitle": "Misc"}, // Go back to the first tab and zoom the first pane { "action": "prevTab", "tabSwitcherMode": "disabled"}, { "action": "moveFocus", "direction": "first"}, "togglePaneZoom" ] }} ``` Results in not zooming or focusing the correct pane. ### Expected Behavior The first new tab will be focused, and the first pane on it should be zoomed. ### Actual Behavior The first new tab is focused, but the last created pane is focused and nothing is zoomed because the `activeTab` is still the 2nd tab even after `prevTab` is run until the event loop catches up.
Author
Owner

@zadjii-msft commented on GitHub (Sep 1, 2021):

You know, I hit this before. TerminalPage::_SelectTab has a special case for "Startup" to handle updating the selected tab without relying on XAML to propagate the events through. That might be part of the trick here.

@zadjii-msft commented on GitHub (Sep 1, 2021): You know, I hit this before. `TerminalPage::_SelectTab` has a special case for "Startup" to handle updating the selected tab without relying on XAML to propagate the events through. That might be part of the trick here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15047