ANSI color is not retained across multiple `print(ln)!`'s in Windows legacy console
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- cli, operating-systems
Research direction
Begin with the Cargo.toml and src/main.rs reproduction on Windows with Legacy Console mode enabled, then trace anstream's handling of ANSI output for that console. Done means the reproduced print! and println! lines retain gray coloring across successive calls, while behavior in the non-legacy console remains correct.
Written by the indexing model from the issue text.
Description
Cargo.toml
[package]
name = "anstream-test"
version = "0.1.0"
edition = "2021"
[dependencies]
anstream = "0.6.18"
src/main.rs
use anstream::{print, println};
fn main() {
print!("\x1b[90m(print!) This text is displayed in gray.\n");
print!("(print!) This text should also be displayed in gray.\n");
println!("\x1b[90m(println!) This text is displayed in gray.");
println!("(println!) This text should also be displayed in gray.\x1b[0m");
}
Steps to reproduce
Run cargo run in CMD/PowerShell with 'Legacy Console mode' enabled.
Expected result
All the lines should be displayed in gray, just like in the non-legacy Windows Console.
Actual result
Only the lines that output \x1b[90m are displayed in gray (1st and 3rd lines).
Environment
- Windows 10 22H2 Home x64
10.0.19045.5011 - Visual Studio Community 2022
17.11.5/ Windows 11 SDK10.0.26100.0 - Default host:
x86_64-pc-windows-msvc - Active toolchain:
stable-x86_64-pc-windows-msvc(default) / rustc1.82.0(f6e511eec 2024-10-15)
- Dominant language
- HTML
- Stars
- 171
- Forks
- 44
- Avg merge
- 3h 4m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-cli/anstyle
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
A-stream
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
A-stream C-bug S-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in rust-cli/anstyle
Similar issues
-
area/testing kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
modelscope/ms-swift#10287 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Doist/todoist-cli#576 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day