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

Strange behavior on Debian linux with any terminal except xterm-color #2085

Open
MiklosPathy opened this issue Oct 15, 2022 · 7 comments
Open

Comments

@MiklosPathy
Copy link

Describe the bug
Barely see anything absolutely no colors, sometimes something flashes up, otherwise mostly black screen. Menu "works", if you can figure out where you are.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest Debian on a Hyper-V virtual machine. Only install SSH.
  2. Install the latest dotnet 6.0 runtime on the machine.
  3. Install libncursesw6, because it will be necessary.
  4. Copy a Release build of the Example to the virtual machine.
  5. Try to run it thru SSH with Putty
  6. Try to run it thru Hyper-V Virtual Machine Connection.

Expected behavior
Works exacly like on Windows.

Screenshots

VirtualMachineConnection

@MiklosPathy
Copy link
Author

Exactly the same problem with the latest official Microsoft Dotnet Docker image, and with the Docker Desktop terminal.

@tznind
Copy link
Collaborator

tznind commented Oct 15, 2022

Hi, thanks for getting in touch. Looks like the colors are not being recognized by the curses driver. What is your $TERM variable? Try setting it to xterm-256color

export TERM=xterm-256color

Another option is to use Application.UseSystemConsole = true (must be set before Init). In the UICatalog samples app this can be done at runtime with -usc.

If you are using a remoting technology e.g. PuTTY then you might need to set this TERM variable in that too, see: #1455

@MiklosPathy
Copy link
Author

MiklosPathy commented Oct 15, 2022

Hi, thank you for you answer.

I played a little with the $TERM variable values. Default is linux in debian. In case of Putty, it is xterm.

On the system console, if i set it to anything else (xterm-16color, xterm-256color, konsole-16color, konsole-256color) the folowing happens:
VirtualMachineConnection-256color
Only highlighted colors, the menu cursor cannot be seen. Also Midnight Commander has only higlighted colors with these settings, so this spoils another applications.

However, xterm-16color and xterm-256color are working in Putty.

Just by a lucky educated guess, i tried on the system console the linux-16colors parameter. This looks the best solution. No highlighted colors only problem, and Midnight Commander also works well.

VirtualMachineConnection-linux-16color

The Application.UseSystemConsole = true solution works on Windows, and in Putty. In linux sytem console forcibly results the highlighted color problem.

Somehow Midninght Commander uses the right colors even if the seting is linux or xterm. Maybe they are using some heuristics in this case?

Best Regards,

@MiklosPathy
Copy link
Author

MiklosPathy commented Oct 15, 2022

Interesting.
In Docker Desktop on Windows 10, the best solution is Application.UseSystemConsole = true
The next best solutions are xterm-16color and xterm-256color. However these, results strange menu and window borders.

Fascinating.

@MiklosPathy MiklosPathy changed the title Not working on Debian linux with PuTTY terminal Strange behavior on Debian linux with any terminal except xterm-color Oct 15, 2022
@tznind
Copy link
Collaborator

tznind commented Oct 15, 2022

Strange. If Midnight Commander works ok out of the box then it should be possible to improve things. At the very least we could look for TERM variables that we know are not going to work and override them to ncurses (hopefully).

@tig
Copy link
Collaborator

tig commented Feb 11, 2023

Two things relative to this:

  1. The coming ConfigurationManager feature (Fixes #2181 - Adds configuration manager #2284) will enable forcing the use of NetDriver (aka System Console) via an external config file for cases where that's the only way to make Terminal.Gui apps work.
  2. Should we consider adding a check to CursesDriver for TERM=xterm-256color and either setting it ourselves, or at least providing a Console.Writeline in Shutdown that highlights that it's not set?

@tznind
Copy link
Collaborator

tznind commented Feb 11, 2023

Should we consider adding a check to CursesDriver for TERM=xterm-256color and either setting it ourselves, or at least providing a Console.Writeline in Shutdown that highlights that it's not set?

I think this is a great idea!

SetEnvironmentVariable(String, String) makes changes for the current process only. So there is no harm in forcing xterm-256color in situations where we know the value the user currently has wont work (e.g. it is blank or linux or one of the other values curses does not understand)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants