Wrong colors after executing bat #7764

Closed
opened 2026-01-31 01:12:06 +00:00 by claunia · 3 comments
Owner

Originally created by @JekRock on GitHub (Apr 28, 2020).

Environment

Windows build number: 10.0.18363.0
Windows Terminal version (if applicable): 0.11.1121.0

Steps to reproduce

  1. Install bat via chocolatey
  2. Create a text file with content that doesn't fit into a screen height
  3. In Windows Terminal push ENTER while the output takes more than the screen height
  4. Open the file created at the second step with the command bat filename
  5. Press q
  6. Now the output has wrong colors that get back to previous colors after a few commands or after the clear command

Expected behavior

Colors should remain the same after executing console utils

Actual behavior

Here is the command prompt before performing anything

Annotation 2020-04-28 170844
The expected bat util output
Annotation 2020-04-28 171203
The bat util output after performing 1-4 steps. Please notice that the ":" in the bottom left corner is now black
Annotation 2020-04-28 171303
The console prompt after performing all described steps
Annotation 2020-04-28 171342

Also, colors remain unchanged if the bat util command is executed right after the clear command

Originally created by @JekRock on GitHub (Apr 28, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Windows build number: 10.0.18363.0 Windows Terminal version (if applicable): 0.11.1121.0 # Steps to reproduce 1. Install [bat](https://github.com/sharkdp/bat) via chocolatey 2. Create a text file with content that doesn't fit into a screen height 3. In Windows Terminal push ENTER while the output takes more than the screen height 4. Open the file created at the second step with the command _bat filename_ 5. Press _q_ 6. Now the output has wrong colors that get back to previous colors after a few commands or after the _clear_ command # Expected behavior Colors should remain the same after executing console utils # Actual behavior Here is the command prompt before performing anything ![Annotation 2020-04-28 170844](https://user-images.githubusercontent.com/5882133/80499246-65c7e700-8975-11ea-8b49-eb8aa1fc99bf.png) The expected bat util output ![Annotation 2020-04-28 171203](https://user-images.githubusercontent.com/5882133/80499325-83954c00-8975-11ea-9782-4415144cd472.png) The bat util output after performing 1-4 steps. Please notice that the ":" in the bottom left corner is now black ![Annotation 2020-04-28 171303](https://user-images.githubusercontent.com/5882133/80499443-a9225580-8975-11ea-8406-fe2a7ee67fe4.png) The console prompt after performing all described steps ![Annotation 2020-04-28 171342](https://user-images.githubusercontent.com/5882133/80499653-ebe42d80-8975-11ea-92ab-4cf5cb2f8503.png) Also, colors remain unchanged if the bat util command is executed right after the _clear_ command
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 01:12:06 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 28, 2020):

This is, unfortunately, an application bug. bat believes that it understands the windows console API, and it's replacing the active color attributes with ones of its choosing.

@DHowett-MSFT commented on GitHub (Apr 28, 2020): This is, unfortunately, an application bug. `bat` believes that it understands the windows console API, and it's replacing the active color attributes with ones of its choosing.
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 28, 2020):

(this happens outside of Terminal too:

image

there's a : there.

)

@DHowett-MSFT commented on GitHub (Apr 28, 2020): (this happens outside of Terminal too: ![image](https://user-images.githubusercontent.com/14316954/80520092-ca674f80-893d-11ea-8dd4-8555d24949c0.png) there's a `:` there. )
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 28, 2020):

(THis could be related to #4177 if less is in the picture.)

@DHowett-MSFT commented on GitHub (Apr 28, 2020): (THis could be related to #4177 if `less` is in the picture.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7764