dart_console icon indicating copy to clipboard operation
dart_console copied to clipboard

Console.writeLine does not align correctly with characters that do not have width 1

Open mrcsh opened this issue 2 years ago • 0 comments

When using Console.writeLine() to print strings that have either tabs or embedded ANSI codes. The resulting output is longer than the width of the screen so it appears that there are extra new lines but it's just the actual lines wrapped before the actual newline is printed.

I have worked around it with just using write() with an newline in the supplied string.

I double checked and the behavior is not present in 1.0. The change to have writeLine() call writeAligned() is likely the culprit and the non-single width characters are causing the alignment to be miscalculated.

I don't know this if this is even reasonable to fix as it would require knowing how the terminal is actually rendering the string.

So this is mostly to document, and suggest maybe changing current writeLine to writeLineAlinged and having writeLine behave as previously.

mrcsh avatar Aug 10 '22 12:08 mrcsh