File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,15 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
196196 [ScriptBlock ]$Prompt = {
197197 $lastSUCCESS = $?
198198 $realLastExitCode = $LastExitCode
199+
200+ # Emit OSC 9;9 sequence for Windows Terminal directory tracking
201+ # This enables "Duplicate Tab" and "Split Pane" to preserve the working directory
202+ # Only active in Windows Terminal ($env:WT_SESSION) or ConEmu ($env:ConEmuPID)
203+ $loc = $executionContext.SessionState.Path.CurrentLocation
204+ if (($env: WT_SESSION -or $env: ConEmuPID ) -and $loc.Provider.Name -eq " FileSystem" ) {
205+ Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]27 ) ]9;9;`" $ ( $loc.ProviderPath ) `" $ ( [char ]27 ) \"
206+ }
207+
199208 $host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath - Leaf
200209 Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]0x200B ) `r $ ( [char ]0x1B ) [K"
201210 if ($lastSUCCESS -or ($LastExitCode -ne 0 )) {
You can’t perform that action at this time.
0 commit comments