spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Unknown console width results in 80 width, becomes hard to read when writing errors for visual studio

Open madeso opened this issue 2 years ago • 2 comments

Information

  • OS: Windows
  • Version: 0.44.0
  • Terminal: Visual Studio 2022 (I guess)

Describe the bug When running a spectre console app through visual studio as a custom build, System.Console.BufferWidth throws a IOException and sets the console width to 80 (I'm guessing based on reading this and this) . This makes sense in general, but when outputting errors (and especially when including the path to the file) , lines can get pretty long, and as far as I can tell visual studio only reads the first line when parsing the output for the error list.

Visual studio error list: image

Output from app (Visual studio output):

1>C:\dev\euphoria\libs\core\src\core\aabb.h(22): error : Members for
1>euphoria::core::Aabb are orderd badly, can't go from Calculators (vec3f
1>wrap(const vec3f &vec) const) to Manipulators (void extend(const vec3f &vec))!

To Reproduce Run a spectre enabled program that prints a line longer than 80 as a build step from visual studio.

I used the following to trigger a run via cmake in another solution

add_custom_target(run_spectre_app path_to_binary)

Expected behavior I'm honestly not sure what I expect. Like I said, 80 makes sense in general but it would be great if the word wrap could be disabled or the default could be changed for the special cases when a console can't be detected.

For example:

AnsiConsole.DefaultWidth = 8000;
// or
AnsiConsole.DefaultWidth = AnsiConsole.NoWordwrap;

Additional context For a workaround I detect if there isn't a console attached and switch to Console.WriteLine, not a elegant solution but it works.

image


Please upvote :+1: this issue if you are interested in it.

madeso avatar Feb 12 '23 21:02 madeso

I think I'm having the same problem.

I have a console application that outputs a very long string as part of a yaml property. When piping the output into a file, the line is wrapped. The same doesn't happen when running the program without piping.

Kralizek avatar Apr 13 '23 13:04 Kralizek

I also want to increase the width from 80 to 120 characters !

stefc avatar Jul 23 '23 07:07 stefc