Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String longer than AnsiConsole.Profile.Out.Width Causes Disjointed Output #1031

Open
Cooksauce opened this issue Oct 27, 2022 · 0 comments
Open
Labels
bug Something isn't working needs triage

Comments

@Cooksauce
Copy link

Cooksauce commented Oct 27, 2022

Information

  • OS: MacOS
  • Version: 0.45.0
  • Terminal: zsh

Describe the bug
There appears to be a space or "space-like" character added after IAnsiConsoleOutput.Width when writing a continuous string to the output. This causes problems using Spectre in scripting scenarios where the output string is needed to run further commands.
This behavior does not occur with BCL Console.Write(..)

To Reproduce

  • create new net6.0 console project with Spectre nuget package
  • create Program.cs as snippet below
  • open zsh shell
  • run echo $(dotnet run --project /path/to/Project/Project.csproj)

Expected behavior
The output should not have any special characters. It should be:

000000000000000000000000000000000000000000000000000000000000000000000000000000000082Profile Width: 80

Instead, it appears there is a something added after the 80'th character which the subshell interprets as space-like
Actual output:

00000000000000000000000000000000000000000000000000000000000000000000000000000000 0082Profile Width: 80

This is more apparent if you pipe to od:
echo $(dotnet run --project /path/to/Project/Project.csproj) | od -Ax -c

0000000    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
*
0000050        0   0   8   2   P   r   o   f   i   l   e       w   i   d
0000060    t   h   :       8   0  \n                                    
0000067

Program.cs

var str = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000";
AnsiConsole.Write(str);
AnsiConsole.Write(str.Length.ToString());
AnsiConsole.Write($"Profile width: {AnsiConsole.Profile.Out.Width}");
return 0;

Possibly related to #216?


Please upvote 👍 this issue if you are interested in it.

@Cooksauce Cooksauce added bug Something isn't working needs triage labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
Status: Todo 🕑
Development

No branches or pull requests

1 participant