1

I am writing an application that connect to a Linux box from Windows console over a custom socket, and I need to tell the Linux box what my console is capable of through TERM environment variable. For now I set TERM=dumb, but it is too limited. In particular I need Linux side to know that:

  1. I am reading input with standard reads from stdin, so no ESC, F1 and arrows are passed (but TAB is)
  2. Windows console has autowrap
  3. It is unable to process ANSI color sequences
  4. It is able to process carriage returns to draw progress bars

Is there an good profile in terminfo database for such Windows console? If there is an extended profile on top of that that can be used when my app will finally recognize ANSI colors?

UPDATE: Somebody voted to close this as too broad, so I edited the question to be very specific about capabilities of Windows console that should be reflected in terminfo entry.

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
  • Have you looked for a library that implements VT100 emulation over the console API, like how PDCurses implements curses? Offhand I don't know of one, at least not for C/C++. You could also support the console's [virtual terminal mode](https://msdn.microsoft.com/en-us/library/mt638032) in Windows 10 and detect VT100/ANSI support when running under ANSICON or ConEmu. – Eryk Sun Jun 17 '17 at 01:47
  • @eryksun I am actually doing it for Go - https://github.com/lxc/lxd/issues/1317 - but for now I'd like commands like `apt update` to properly recognize terminal width and use carriage return to draw progress bars. – anatoly techtonik Jun 17 '17 at 05:35
  • Your question is basically asking for how to write a customized terminal description (tutorials are off-topic). – Thomas Dickey Aug 25 '20 at 22:34

1 Answers1

0

The windows console and windows terminal in version 10 are a lot more capable. You may be able to get away with TERM=xterm-256color with those.

For older versions perhaps look into loading ANSICON first. This adds solid 8-color support. Otherwise try a simple term definition, such as those below which don't support color:

  • glasstty super simple, just above dumb
  • interix "nt console"
  • pcansi
  • ansi77
Gringo Suave
  • 29,931
  • 6
  • 88
  • 75
  • The terminal descriptions for `interix` and `pcansi` state that the terminal supports 8 ANSI colors. The Windows Terminal isn't very close to `xterm-256color`. – Thomas Dickey Aug 25 '20 at 22:31
  • Actually you can very much use xterm-256color in Windows Terminal and is in fact what's recommended for conhost as well for remote connections. If you do `echo $TERM`, it reports itself as xterm-256color. – WSLUser Nov 19 '20 at 16:56