@@ -98,8 +98,7 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
9898 # Display an extra prompt line between the prompt and the command input
9999 Set-PSReadlineOption - ExtraPromptLineCount 1
100100
101- # Add OSC 133;C support for Windows Terminal shell integration
102- # This marks the start of command output (emitted when Enter is pressed)
101+ # Invoked when Enter is pressed to submit a command
103102 if ($env: WT_SESSION ) {
104103 Set-PSReadLineKeyHandler - Key Enter - ScriptBlock {
105104 # Get the current command line
@@ -110,7 +109,7 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
110109 # Accept the line first
111110 [Microsoft.PowerShell.PSConsoleReadLine ]::AcceptLine()
112111
113- # Emit OSC 133;C sequence to mark start of command output
112+ # Emit OSC 133;C to mark start of command output
114113 # This is written directly to the console after the command is accepted
115114 [Console ]::Write(" $ ( [char ]0x1B ) ]133;C$ ( [char ]7 ) " )
116115 }
@@ -221,20 +220,22 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
221220 $lastSUCCESS = $?
222221 $realLastExitCode = $LastExitCode
223222
224- # Emit terminal -specific escape sequences for Windows Terminal and ConEmu
223+ # Terminal -specific escape sequences for Windows Terminal and ConEmu
225224 if ($env: WT_SESSION -or $env: ConEmuPID ) {
226- # OSC 133;D - Mark end of command execution with exit code (Windows Terminal only)
225+ # Emit OSC 133;D to mark the end of command execution with exit code
227226 if ($env: WT_SESSION ) {
228227 Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]0x1B ) ]133;D;$realLastExitCode $ ( [char ]7 ) "
229228 }
230229
231- # OSC 9;9 - Enable directory tracking for "Duplicate Tab" and "Split Pane"
230+ # Emit OSC 9;9 to mark the start of the prompt
231+ # Enables directory tracking for "Duplicate Tab" and "Split Pane"
232232 $loc = $executionContext.SessionState.Path.CurrentLocation
233233 if ($loc.Provider.Name -eq " FileSystem" ) {
234234 Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]0x1B ) ]9;9;`" $ ( $loc.ProviderPath ) `" $ ( [char ]0x1B ) \"
235235 }
236236
237- # OSC 133;A - Mark start of prompt (Windows Terminal only)
237+ # Emit OSC 133;A to mark the start of the prompt
238+ # Enables features like command navigation, selection, and visual separators
238239 if ($env: WT_SESSION ) {
239240 Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]0x1B ) ]133;A$ ( [char ]7 ) "
240241 }
@@ -249,7 +250,7 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
249250 CmderPrompt
250251 PostPrompt | Microsoft.PowerShell.Utility\Write-Host - NoNewline
251252
252- # OSC 133;B - Mark start of command input (Windows Terminal only )
253+ # Emit OSC 133;B to mark the start of command input (after prompt, before user types )
253254 if ($env: WT_SESSION ) {
254255 Microsoft.PowerShell.Utility\Write-Host - NoNewline " $ ( [char ]0x1B ) ]133;B$ ( [char ]7 ) "
255256 }
0 commit comments