PowerShell custom prompt bugs out last character on a "syntax error" line #20711

Open
opened 2026-01-31 07:21:51 +00:00 by claunia · 0 comments
Owner

Originally created by @azurenekowo on GitHub (Oct 21, 2023).

Windows Terminal version

1.19.2682.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

My custom prompt is implemented via the following (added into $profile):

function prompt {
     "$BASE[38;5;141m$env:username@$env:computername$BASE[38;5;228m: $BASE[38;5;250m$pwd $BASE[38;5;14m~#$RESET "
}

By default, it should show up as : username@DESKTOP-xxxxxx: C:\Users\username ~#

However, when I, say enter an invalid syntax (just typing echo ", not even executing it), it will bug out the last character (in this case, # with a red m).

image

It will persist until I press Enter, which executes the command and prompts again.
image

Expected Behavior

It shouldn't bug out the last character of the prompt.

Actual Behavior

It did bug out.
image

Originally created by @azurenekowo on GitHub (Oct 21, 2023). ### Windows Terminal version 1.19.2682.0 ### Windows build number 10.0.19045.0 ### Other Software _No response_ ### Steps to reproduce My custom prompt is implemented via the following (added into `$profile`): ```powershell function prompt { "$BASE[38;5;141m$env:username@$env:computername$BASE[38;5;228m: $BASE[38;5;250m$pwd $BASE[38;5;14m~#$RESET " } ``` By default, it should show up as : `username@DESKTOP-xxxxxx: C:\Users\username ~#` However, when I, say enter an invalid syntax (just typing `echo "`, not even executing it), it will bug out the last character (in this case, `#` with a red `m`). ![image](https://github.com/microsoft/terminal/assets/67498765/19bb1170-48fc-4be4-a098-ea18747f9326) It will persist until I press <kbd>Enter</kbd>, which executes the command and prompts again. ![image](https://github.com/microsoft/terminal/assets/67498765/3a0fee46-9e6a-4155-ba18-20bd8191de8e) ### Expected Behavior It shouldn't bug out the last character of the prompt. ### Actual Behavior It did bug out. ![image](https://github.com/microsoft/terminal/assets/67498765/0394266b-140e-40b6-a235-fb1f5914e79d)
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 07:21:51 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20711