Mpdreamz / shellprogressbar

ShellProgressBar - display progress in your console application
MIT License
1.43k stars 134 forks source link

Calc character width correct #107

Open heroboy opened 7 months ago

heroboy commented 7 months ago

Should correctly calc the char width in console. Not simply using String.Length.

Consider this implement:

https://github.com/gui-cs/NStack/blob/92b5d7f56bad11a9ce637797d0c8c4a14d6f50c5/NStack/unicode/Rune.ColumnWidth.cs#L152

frg2089 commented 5 months ago

Some characters are twice as wide as normal ASCII characters.

image

Even though we have ProgressBarOptions.MessageEncodingName to mitigate this. But I think encoding length and character width are two different things.

heroboy commented 5 months ago

The current implementation is from https://github.com/Mpdreamz/shellprogressbar/pull/82 It is totally wrong. It can be a workaround to be used in a limited area. But it shouldn't be merged.