Skip to content

Commit

Permalink
Merge pull request microsoft#210521 from microsoft/tyriar/210353
Browse files Browse the repository at this point in the history
Only send 633;E nonce when not Windows 10
  • Loading branch information
Tyriar authored Apr 17, 2024
2 parents 3211128 + aac6f9c commit f1c978d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $Global:__LastHistoryId = -1
$Nonce = $env:VSCODE_NONCE
$env:VSCODE_NONCE = $null

$osVersion = [System.Environment]::OSVersion.Version
$isWindows10 = $IsWindows10 -and $osVersion.Major -eq 10 -and $osVersion.Minor -eq 0 -and $osVersion.Build -lt 22000

if ($env:VSCODE_ENV_REPLACE) {
$Split = $env:VSCODE_ENV_REPLACE.Split(":")
foreach ($Item in $Split) {
Expand Down Expand Up @@ -105,9 +108,12 @@ if (Get-Module -Name PSReadLine) {
# OSC 633 ; E ; <CommandLine?> ; <Nonce?> ST
$Result = "$([char]0x1b)]633;E;"
$Result += $(__VSCode-Escape-Value $CommandLine)
$Result += ";$Nonce"
# Only send the nonce if the OS is not Windows 10 as it seems to echo to the terminal
# sometimes
if ($IsWindows10 -eq $false) {
$Result += ";$Nonce"
}
$Result += "`a"
[Console]::Write($Result)

# Command executed
# OSC 633 ; C ST
Expand Down

0 comments on commit f1c978d

Please sign in to comment.