spectre.console
spectre.console copied to clipboard
Invalid and misaligned json produced with JsonText
Information
- OS: Windows 11
- Version: 0.51.1
- Terminal: Windows Terminal
Describe the bug When the terminal size becomes small enough, newlines are introduced into long strings, producing invalid json. This also happens when the output is redirected.
Properties can also become misaligned (see property3 below).
To Reproduce
_ansiConsole.Write(
new JsonText(jsonOutput)
Example json output:
{
"example1": "value",
"example2": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
yyyyyyyyyyyyyyyyyyyyy",
"example3": {
"property1": "1111111111111111",
"property2": "22222222222222", "property3": 333333333,
"property4": "2325bb6f-6f46-2e90-2d9b-b414989b9035",
}
}
Expected behavior Long strings should not be wrapped by spectre, especially when output is redirected. Json properties should always be correctly aligned.
Please upvote :+1: this issue if you are interested in it.