Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 31, 2025

When a terminal is moved into a new window using "Move Terminal into New Window" and then the "Create New Terminal" command (Ctrl+Shift+`) is executed from that auxiliary window, the terminal was incorrectly being created in the original main window instead of the current auxiliary window.

Problem

The issue occurred because the TerminalCommandId.New action did not consider which window context it was running in. It would always fall back to the terminal service's defaultLocation (Panel or Editor based on configuration), which targets the main window.

Solution

Modified the terminal creation logic in terminalActions.ts to:

  1. Detect auxiliary window context using VS Code's built-in IsAuxiliaryWindowContext context key
  2. Target the current auxiliary window by setting the terminal location to the active editor group in that window using editorGroupToColumn(editorGroupsService, editorGroupsService.activeGroup)
  3. Preserve existing behavior for main windows and when explicit locations are already specified

Changes

  • Added imports for IContextKeyService and IsAuxiliaryWindowContext
  • Added auxiliary window detection logic in the TerminalCommandId.New action handler
  • When in an auxiliary window and no explicit location is provided, the terminal is now created in that window's editor area

The fix is minimal and conservative - it only changes behavior for auxiliary windows and only when no explicit location is specified, ensuring no regressions in existing functionality.

Fixes #259000.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Tyriar Tyriar added this to the August 2025 milestone Jul 31, 2025
…indow context

Co-authored-by: Tyriar <2193314+Tyriar@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Running the create new terminal command when inside a new window should create the terminal in that window Fix terminal creation in auxiliary windows when using Ctrl+Shift+` Jul 31, 2025
@Copilot Copilot AI requested a review from Tyriar July 31, 2025 13:09
Copilot finished work on behalf of Tyriar July 31, 2025 13:09
@Tyriar Tyriar marked this pull request as ready for review August 4, 2025 12:16
@Tyriar Tyriar merged commit b745298 into main Aug 4, 2025
18 checks passed
@Tyriar Tyriar deleted the copilot/fix-259000 branch August 4, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running the create new terminal command when inside a new window should create the terminal in that window
3 participants