Command-line-api: Eager to try out VirtualTerminal Rendering but it doesn't appear functional

Created on 4 May 2019  路  7Comments  路  Source: dotnet/command-line-api

I'm running on the latest insiders build Windows, so the VT support is reasonably good. That said, I can't get your rendering library to do anything useful despite it _looking_ like it should be testable. Then I saw all of your rendering tests are marked to be skipped, and your rendering playground, well, just corrupts the console and does nothing else (tried Dir, Clock samples etc). I'm guessing things are floating in the air at the moment?

Most helpful comment

This area is still very experimental and the API is far from ready. The hope is that it will eventually "just work", detecting terminal capabilities and adjusting behavior as needed, while the directives will be available for overriding the defaults. Region should be an implementation detail and not something people need to use directly.

There should also eventually be different render modes, to support scrolling versus taking over the screen to allow in-place re-rendering.

All 7 comments

Also, the VirtualTerminal IConsole's DetectOutputMode returns "PlainText" where I'd imagine it to return Ansi.

EDIT: I understand the difficulty of testing console-related code in a test runner that doesnt' neccessarily have an allocated console, nor the ability to allocate one. I have some ideas, maybe I can help out.

There was a regression in the auto-detection of the terminal mode when we added rendering hints via directives, which we did so that all apps can take advantage of the same functionality.

Try these in the RenderingPlayground directory:

> dotnet run -- [enable-vt] [output:ansi] --sample dir
> dotnet run -- [enable-vt] [output:ansi] --sample clock

A question: Why doesn't it work correctly when I run dotnet RenderingPlayground.dll ... from the target folder? It doesn't error out, but the screen clears and nothing is rendered. For the color sample, it renders the stars but not in color. Very curious. When I run it from the project folder with dotnet run ... all is well.

This worked for me:

> dotnet publish -r win-x64 #from within the RenderingPlayground directory
> C:\dev\command-line-api\samples\RenderingPlayground\bin\Debug\netcoreapp2.1\win-x64\publish\RenderingPlayground.exe [output:ansi] --sample colors

I confirm running dotnet run --project .\samples\RenderingPlayground\RenderingPlayground.csproj -- [enable-vt] [output:ansi] --sample colors works, but I'd like this to work "by default" on e.g. PowerShell where colors are supported. I was surprised to see this issue was closed _and_ that there was a regression, which doesn't seem fixed on master e73e344.

Is there another open issue, or did I miss something and it's "normal" that colors do not work on PowerShell? I'm running PowerShell 5.1 build 18362 rev 145.

Ah, I think I just understood the referenced issue 583. Here's what I did to get color rendering to "work":

var terminal = new SystemConsole().GetTerminal();
var renderer = new ConsoleRenderer(terminal);

I still have a hard time putting the pieces together though, as I'd like rendering to happen starting with the "next line" in the console rather than specifying a character using Region, but this is unrelated. I think the expectations for what the renderer does and does not do, and how to use it, could be clarified (i.e. an "introduction" to the renderer). Hopefully my findings can be useful to future readers!

This area is still very experimental and the API is far from ready. The hope is that it will eventually "just work", detecting terminal capabilities and adjusting behavior as needed, while the directives will be available for overriding the defaults. Region should be an implementation detail and not something people need to use directly.

There should also eventually be different render modes, to support scrolling versus taking over the screen to allow in-place re-rendering.

Was this page helpful?
0 / 5 - 0 ratings