Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 16, 2025

Implements OSC 9;9 escape sequence emission in Cmder's PowerShell prompt to enable Windows Terminal's "Duplicate Tab" and "Split Pane" features to preserve the current working directory. This matches the recent fix for cmd.exe/Clink and follows Microsoft's published guidance for Windows Terminal integration.

Changes Made

Modified vendor/profile.ps1:

  • Added OSC 9;9 sequence emission in the main $Prompt scriptblock
  • Only emits when running in Windows Terminal ($env:WT_SESSION) or ConEmu ($env:ConEmuPID)
  • Only emits for FileSystem provider paths (skips Registry, etc.)
  • Added comprehensive comments explaining the functionality

Updated README.md:

  • Added documentation about Windows Terminal directory tracking support
  • Noted that both cmd.exe and PowerShell sessions now support this functionality

Implementation Details

The OSC 9;9 sequence (ESC]9;9;"<path>"ESC\) is emitted before each prompt display when:

  1. Running in a supported terminal environment (Windows Terminal or ConEmu)
  2. Current location uses the FileSystem provider
  3. All conditions are met for directory tracking

This implementation is:

  • Non-invasive: No changes to prompt appearance or existing functionality
  • Compatible: Works with existing posh-git and user customizations
  • Gated: Only active in supported terminal environments
  • Safe: Only emits for appropriate path types

Example Usage

When using Cmder with PowerShell in Windows Terminal:

  1. Navigate to any directory: cd C:\Projects\MyApp
  2. Use Ctrl+Shift+D to duplicate tab → new tab opens in C:\Projects\MyApp
  3. Use split pane operations → new panes open in the same directory

This provides the same seamless directory tracking experience that cmd.exe/Clink users have enjoyed.

Fixes #3025.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

This comment was marked as off-topic.

Copilot AI and others added 2 commits September 16, 2025 10:52
…directory tracking

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
…ntation

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [Feature request] Add OSC 9;9 support for PowerShell prompt in Cmder to enable Windows Terminal duplicate/split in same directory Add OSC 9;9 support for PowerShell prompt to enable Windows Terminal directory tracking Sep 16, 2025
Copilot finished work on behalf of DRSDavidSoft September 16, 2025 10:55
@Copilot Copilot AI requested a review from DRSDavidSoft September 16, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Add OSC 9;9 support for PowerShell prompt in Cmder to enable Windows Terminal duplicate/split in same directory
2 participants