@@ -531,12 +531,12 @@ private Task EnableShellIntegrationAsync(CancellationToken cancellationToken)
531
531
if ($Global:__LastHistoryId -ne -1) {
532
532
if ($LastHistoryEntry.Id -eq $Global:__LastHistoryId) {
533
533
# Don't provide a command line or exit code if there was no history entry (eg. ctrl+c, enter on no command)
534
- $Result = ""`e ]633;E`a""
535
- $Result += ""`e ]633;D`a""
534
+ $Result = ""$([char]0x1b) ]633;E`a""
535
+ $Result += ""$([char]0x1b) ]633;D`a""
536
536
} else {
537
537
# Command finished command line
538
538
# OSC 633 ; A ; <CommandLine?> ST
539
- $Result = ""`e ]633;E;""
539
+ $Result = ""$([char]0x1b) ]633;E;""
540
540
# Sanitize the command line to ensure it can get transferred to the terminal and can be parsed
541
541
# correctly. This isn't entirely safe but good for most cases, it's important for the Pt parameter
542
542
# to only be composed of _printable_ characters as per the spec.
@@ -549,27 +549,27 @@ private Task EnableShellIntegrationAsync(CancellationToken cancellationToken)
549
549
$Result += ""`a""
550
550
# Command finished exit code
551
551
# OSC 633 ; D [; <ExitCode>] ST
552
- $Result += ""`e ]633;D;$FakeCode`a""
552
+ $Result += ""$([char]0x1b) ]633;D;$FakeCode`a""
553
553
}
554
554
}
555
555
# Prompt started
556
556
# OSC 633 ; A ST
557
- $Result += ""`e ]633;A`a""
557
+ $Result += ""$([char]0x1b) ]633;A`a""
558
558
# Current working directory
559
559
# OSC 633 ; <Property>=<Value> ST
560
- $Result += if($pwd.Provider.Name -eq 'FileSystem'){""`e ]633;P;Cwd=$($pwd.ProviderPath)`a""}
560
+ $Result += if($pwd.Provider.Name -eq 'FileSystem'){""$([char]0x1b) ]633;P;Cwd=$($pwd.ProviderPath)`a""}
561
561
# Before running the original prompt, put $? back to what it was:
562
562
if ($FakeCode -ne 0) { Write-Error ""failure"" -ea ignore }
563
563
# Run the original prompt
564
564
$Result += $Global:__VSCodeOriginalPrompt.Invoke()
565
565
# Write command started
566
- $Result += ""`e ]633;B`a""
566
+ $Result += ""$([char]0x1b) ]633;B`a""
567
567
$Global:__LastHistoryId = $LastHistoryEntry.Id
568
568
return $Result
569
569
}
570
570
571
571
# Set IsWindows property
572
- Write-Host -NoNewLine ""`e ]633;P;IsWindows=$($IsWindows)`a""
572
+ Write-Host -NoNewLine ""$([char]0x1b) ]633;P;IsWindows=$($IsWindows)`a""
573
573
574
574
# Set always on key handlers which map to default VS Code keybindings
575
575
function Set-MappedKeyHandler {
0 commit comments