mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-09 13:49:05 +08:00
Add OSC 133;D support for command exit code tracking
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
@@ -354,7 +354,7 @@ However, Cmder can in fact run in a variety of other terminal emulators, and eve
|
||||
|
||||
⚠ *Note:* Cmder includes built-in support for Windows Terminal directory tracking via OSC 9;9 sequences. This enables "Duplicate Tab" and "Split Pane" features to preserve the current working directory for both `cmd.exe` and PowerShell sessions.
|
||||
|
||||
⚠ *Note:* Cmder also includes built-in support for [Windows Terminal shell integration](https://learn.microsoft.com/en-us/windows/terminal/tutorials/shell-integration) via OSC 133 sequences (A, B, C) for PowerShell sessions. This enables features like command navigation (jump between commands), command selection, visual command separators, and improved command history management in Windows Terminal.
|
||||
⚠ *Note:* Cmder also includes built-in support for [Windows Terminal shell integration](https://learn.microsoft.com/en-us/windows/terminal/tutorials/shell-integration) via OSC 133 sequences (A, B, C, D) for PowerShell sessions. This enables features like command navigation (jump between commands), command selection, visual command separators, command exit code tracking, and improved command history management in Windows Terminal.
|
||||
|
||||
For instructions on how to integrate Cmder with your IDE, please read our [Wiki section](https://github.com/cmderdev/cmder/wiki#cmder-integration).
|
||||
|
||||
|
||||
8
vendor/profile.ps1
vendored
8
vendor/profile.ps1
vendored
@@ -221,6 +221,14 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
|
||||
$lastSUCCESS = $?
|
||||
$realLastExitCode = $LastExitCode
|
||||
|
||||
# Emit OSC 133;D sequence for Windows Terminal shell integration
|
||||
# This marks the end of command execution with the exit code
|
||||
# Must be emitted before OSC 133;A (start of next prompt)
|
||||
# Only active in Windows Terminal ($env:WT_SESSION)
|
||||
if ($env:WT_SESSION) {
|
||||
Microsoft.PowerShell.Utility\Write-Host -NoNewline "$([char]0x1B)]133;D;$realLastExitCode$([char]7)"
|
||||
}
|
||||
|
||||
# Emit OSC 9;9 sequence for Windows Terminal directory tracking
|
||||
# This enables "Duplicate Tab" and "Split Pane" to preserve the working directory
|
||||
# Only active in Windows Terminal ($env:WT_SESSION) or ConEmu ($env:ConEmuPID)
|
||||
|
||||
Reference in New Issue
Block a user