crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

`Display` implementation for `StyledContent` ignores formatting parameters

Open abusch opened this issue 4 years ago • 1 comments

Describe the bug The Display implementation for StyledContent ignores the formatting parameters, such padding or alignment.

To Reproduce Steps to reproduce the behavior:

use crossterm::style::{Stylize, style};

fn main() {
    println!("{:>50}", style("Hello, world!").red());
    println!("{:>50}", "Hello, world!");
}

This results in the following output: 20210801_18h37m37s_grim

Expected behavior I would expect the formatting parameters to be respected, like other crates do (e.g. console).

OS Linux

Terminal/Console Alacritty

abusch avatar Aug 01 '21 08:08 abusch

You might want to try out the Print command. This will use the print! as underlying draw operation. I think that would solve the issue as a work arround.

TimonPost avatar Aug 23 '21 15:08 TimonPost