@@ -25,12 +25,12 @@ function Global:Prompt() {
25
25
if ($Global :__LastHistoryId -ne -1 ) {
26
26
if ($LastHistoryEntry.Id -eq $Global :__LastHistoryId ) {
27
27
# Don't provide a command line or exit code if there was no history entry (eg. ctrl+c, enter on no command)
28
- $Result = " `e ]633;E`a "
29
- $Result += " `e ]633;D`a "
28
+ $Result = " $ ( [ char ] 0x1b ) ]633;E`a "
29
+ $Result += " $ ( [ char ] 0x1b ) ]633;D`a "
30
30
} else {
31
31
# Command finished command line
32
32
# OSC 633 ; A ; <CommandLine?> ST
33
- $Result = " `e ]633;E;"
33
+ $Result = " $ ( [ char ] 0x1b ) ]633;E;"
34
34
# Sanitize the command line to ensure it can get transferred to the terminal and can be parsed
35
35
# correctly. This isn't entirely safe but good for most cases, it's important for the Pt parameter
36
36
# to only be composed of _printable_ characters as per the spec.
@@ -43,21 +43,21 @@ function Global:Prompt() {
43
43
$Result += " `a "
44
44
# Command finished exit code
45
45
# OSC 633 ; D [; <ExitCode>] ST
46
- $Result += " `e ]633;D;$FakeCode `a "
46
+ $Result += " $ ( [ char ] 0x1b ) ]633;D;$FakeCode `a "
47
47
}
48
48
}
49
49
# Prompt started
50
50
# OSC 633 ; A ST
51
- $Result += " `e ]633;A`a "
51
+ $Result += " $ ( [ char ] 0x1b ) ]633;A`a "
52
52
# Current working directory
53
53
# OSC 633 ; <Property>=<Value> ST
54
- $Result += if ($pwd.Provider.Name -eq ' FileSystem' ){" `e ]633;P;Cwd=$ ( $pwd.ProviderPath ) `a " }
54
+ $Result += if ($pwd.Provider.Name -eq ' FileSystem' ){" $ ( [ char ] 0x1b ) ]633;P;Cwd=$ ( $pwd.ProviderPath ) `a " }
55
55
# Before running the original prompt, put $? back to what it was:
56
56
if ($FakeCode -ne 0 ) { Write-Error " failure" - ea ignore }
57
57
# Run the original prompt
58
58
$Result += $Global :__VSCodeOriginalPrompt.Invoke ()
59
59
# Write command started
60
- $Result += " `e ]633;B`a "
60
+ $Result += " $ ( [ char ] 0x1b ) ]633;B`a "
61
61
$Global :__LastHistoryId = $LastHistoryEntry.Id
62
62
return $Result
63
63
}
@@ -69,13 +69,13 @@ if (Get-Module -Name PSReadLine) {
69
69
function Global :PSConsoleHostReadLine {
70
70
$tmp = $__VSCodeOriginalPSConsoleHostReadLine.Invoke ()
71
71
# Write command executed sequence directly to Console to avoid the new line from Write-Host
72
- [Console ]::Write(" `e ]633;C`a " )
72
+ [Console ]::Write(" $ ( [ char ] 0x1b ) ]633;C`a " )
73
73
$tmp
74
74
}
75
75
}
76
76
77
77
# Set IsWindows property
78
- [Console ]::Write(" `e ]633;P;IsWindows=$ ( $IsWindows ) `a " )
78
+ [Console ]::Write(" $ ( [ char ] 0x1b ) ]633;P;IsWindows=$ ( $IsWindows ) `a " )
79
79
80
80
# Set always on key handlers which map to default VS Code keybindings
81
81
function Set-MappedKeyHandler {
0 commit comments