Open Decimation opened 2 years ago
thank you @Decimation I will check it when I have more time, sorry quite busy these days
@Decimation can you pls give me a sample of code so I can reproduce it
@Decimation can you pls give me a sample of code so I can reproduce it
The first picture in the OP contains one but I'll send a more concrete example later when possible
The issue makes ugly the to colorize output, because color characters in console are calculated as table width. For example showing negative numbers in RED
.WithFormatter(4, text =>
{
if (Int32.Parse(text.ToString()) < 0)
{
return text.ToString().Pastel(Color.Red);
}
return text.ToString();
})
Is shown like this
| Days |
-|----------------------------|
| -811 |
| -553 |
| -546 |
Description
Special control characters such as ANSI escape codes are included in calculation of row length (which is determined by string length). This results in table rows appearing larger than they should be.
Example:
This is used for the row (outlined); the ANSI escape sequence is red![yWxj5WcF8h_2022-05-06_(03h47m50s)](https://user-images.githubusercontent.com/4624891/167099010-056fe5f0-6544-47c0-8d3e-882225669648.png)
This results in the following output:
This is because the length of the ANSI escape characters in the example is
7
, which results in7
additional characters in the row cell:Possible Solution
A possible solution would be using regex to filter such characters and escape sequences from the row content string, and using the resulting string length to determine the row length.
See Console virtual terminal sequences