First Line in Video Buffer Does not Match Expanded Color Codes in Bash Prompt until Redraw #18125

Closed
opened 2026-01-31 06:04:22 +00:00 by claunia · 2 comments
Owner

Originally created by @danieldusharm on GitHub (Aug 6, 2022).

Windows Terminal version

1.14.1962.0

Windows build number

10.0.19044 Build 19044

Other Software

Ubuntu 20.04 LTS
Bash
WSL 2

Steps to reproduce

Using bash on ubuntu 20 lts

Set PS1 to a prompt with color codes in bash profile file (.bashrc)
Example:
PS1="\[\e[48;5;1m\] USER \[\e[48;5;23m\] HOST \[\e[0m\]"

Create a new window or tab

Enter any command or newline

image

Expected Behavior

The color codes drawn as expanded are drawn the same on first line of the video buffer as lines that proceed it

image

Actual Behavior

When creating a new window or tab the color codes are not drawn as expected for the first line of the terminal. Proceeding lines (unless prompt contains \n) are drawn correctly. In the event of a redraw while the video buffer hasn't been committed the first line is drawn correctly

image
after video buffer is submitted

image
First line

image
First line after redrawing window (via window resize)

using PS1="\[\e[48;5;1m\] USER \n\[\e[48;5;23m\] HOST \[\e[0m\]"

image
new tab where \n is in prompt

image
new tab where \n is in prompt after redrawing window (notice the commited line before the \n is still drawn incorrectly)

image
seccond prompt showing what the draw should look like

Once the first line is committed to the video buffer without redrawing it stays broken
This is not the case for other terminals like the vscode integrated terminal
image

Originally created by @danieldusharm on GitHub (Aug 6, 2022). ### Windows Terminal version 1.14.1962.0 ### Windows build number 10.0.19044 Build 19044 ### Other Software Ubuntu 20.04 LTS Bash WSL 2 ### Steps to reproduce Using bash on ubuntu 20 lts Set PS1 to a prompt with color codes in bash profile file (.bashrc) Example: `PS1="\[\e[48;5;1m\] USER \[\e[48;5;23m\] HOST \[\e[0m\]"` Create a new window or tab Enter any command or newline ![image](https://user-images.githubusercontent.com/71316966/183263758-986c3137-ba69-4470-8a12-9dc3227258a3.png) ### Expected Behavior The color codes drawn as expanded are drawn the same on first line of the video buffer as lines that proceed it ![image](https://user-images.githubusercontent.com/71316966/183263837-d802863a-9a0f-4770-af93-bf33fc9bd35d.png) ### Actual Behavior When creating a new window or tab the color codes are not drawn as expected for the first line of the terminal. Proceeding lines (unless prompt contains `\n`) are drawn correctly. In the event of a redraw while the video buffer hasn't been committed the first line is drawn correctly ![image](https://user-images.githubusercontent.com/71316966/183263856-76fe2db0-b3ee-477e-8b14-3ae9d1549a42.png) after video buffer is submitted ![image](https://user-images.githubusercontent.com/71316966/183264025-f84712b5-92a4-4931-90b0-4dc47a9b7684.png) First line ![image](https://user-images.githubusercontent.com/71316966/183264032-f8abef5f-f737-4e17-97c9-757ac64bc0a6.png) First line after redrawing window (via window resize) using `PS1="\[\e[48;5;1m\] USER \n\[\e[48;5;23m\] HOST \[\e[0m\]"` ![image](https://user-images.githubusercontent.com/71316966/183264081-04f2d651-7043-4133-9341-97eed1f1a0b9.png) new tab where \n is in prompt ![image](https://user-images.githubusercontent.com/71316966/183264098-965b37de-05ef-41d1-ab33-a394bfc650fc.png) new tab where \n is in prompt after redrawing window (notice the commited line before the \n is still drawn incorrectly) ![image](https://user-images.githubusercontent.com/71316966/183264123-859191f8-214a-4248-af84-1b4dd7d37835.png) seccond prompt showing what the draw should look like Once the first line is committed to the video buffer without redrawing it stays broken This is not the case for other terminals like the vscode integrated terminal ![image](https://user-images.githubusercontent.com/71316966/183264246-6ace43d5-3813-4f05-a21e-c4f85f8c658a.png)
claunia added the Needs-TriageIssue-BugNeeds-Tag-Fix labels 2026-01-31 06:04:22 +00:00
Author
Owner

@j4james commented on GitHub (Aug 7, 2022):

This looks like #8341.

@j4james commented on GitHub (Aug 7, 2022): This looks like #8341.
Author
Owner

@danieldusharm commented on GitHub (Aug 7, 2022):

Duplicate

@danieldusharm commented on GitHub (Aug 7, 2022): Duplicate
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18125