Re: curses apps on MS Windows?

2021-06-14 Thread Eryk Sun
On 6/13/21, Grant Edwards  wrote:
>
> Are there examples of popular curses applications for Windows?

I don't think are any popular examples. The port of the "nano" editor
uses ncurses.

https://github.com/lhmouse/nano-win

IIRC, PDCurses has better support -- e.g. 256 colors and blinking
under Windows 10 or ConEmu. The Windows ports of Python's curses
module that I know of are based on PDCurses.

> Does windows have a terminfo/termcap subsystem to deal with different
> terminal types?

No, but in Windows 10 the virtual-terminal mode of the console
emulates xterm256-color:

https://github.com/microsoft/terminal/issues/2958
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences

The console host (i.e. conhost.exe, or the open-source build
OpenConsole.exe) supports a headless mode (ConPTY / pseudconsole),
which is what Windows Terminal and the sshd server use. Terminal
support is handled by the host, which defaults to enabling
virtual-terminal mode in a headless session.

The console host process sits in the middle between client
applications and the terminal application or service that created the
console session. For example, each tab in Windows Terminal is a
headless console session that's hosted by a separate instance of
OpenConsole.exe.

Applications are unaware that it's a headless session. They request
the normal read/write/IOCTL operations on console files, which are
provided by the console driver, i.e. condrv.sys in the kernel. The
driver in turn talks to the attached console host. If it's a ConPTY
session, the host talks to the service or terminal application that
created the console session, e.g. WindowsTerminal.exe.

Classically, or without ConPTY, the console host provides a builtin
terminal/console interface, which is what most people are used to in
Windows and what many people confuse with cmd.exe.

Alternate terminals such as ConEmu have existed for a long time, but
prior to ConPTY support their implementation was a pile of hacks. The
terminal had to attach to the console host to read the console's input
and screen buffers and poll the screen for changes, and even inject a
DLL in client applications to hook various API calls.

> Is there such a thing as a Windows ssh server with some sort of shell
> in which one can run console-mode applications?

I've used third-party SSH servers in the past, but Windows 10 includes
an ssh server and client. The sshd.exe server launches a headless
console session, which by default runs an instance of the cmd.exe
shell.

Installation:
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

> Or do the apps only work with the built-in terminal
> windows implemented by command.com/cmd.exe?

cmd.exe is a shell that uses standard I/O. It's not a terminal or
console. It's fundamentally no different from the REPL shell that's
implemented by python.exe, except the cmd.exe shell and batch
scripting language make it relatively easier to administrate the
machine and run programs.

COMMAND.COM is a 16-bit DOS shell from the 1980s and 1990s. Most
people may as well forget about COMMAND.COM, unless they're fascinated
with relics from the 80s.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: curses apps on MS Windows?

2021-06-14 Thread Michael Torrie
On 6/13/21 11:44 AM, Grant Edwards wrote:
> There's been a surprising amount of discussion lately about using
> curses libraries on Windows OS. I'm surprised by this, because I don't
> think I've ever even seen a Windows curses application.
> 
> Are there examples of popular curses applications for Windows?

None that I know of, but then again the Windows console was horrible.
With the advent of the new Windows Terminal, Windows 10 now has a
first-class terminal system with all the capabilities of any Unix
terminal. So who knows, maybe curses might actually find a use on
Windows!  MS seems to be giving the idea of terminal applications a bit
of love.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: curses apps on MS Windows?

2021-06-14 Thread jak

Il 13/06/2021 19:44, Grant Edwards ha scritto:

There's been a surprising amount of discussion lately about using
curses libraries on Windows OS. I'm surprised by this, because I don't
think I've ever even seen a Windows curses application.

Are there examples of popular curses applications for Windows?

Does windows have a terminfo/termcap subsystem to deal with different
terminal types? Or do the apps only work with the built-in terminal
windows implemented by command.com/cmd.exe?

Can windows curses apps be used via real serial terminals? Is that
even "a thing" under Windows?

Is there such a thing as a Windows ssh server with some sort of shell
in which one can run console-mode applications?

--
Grant




https://winaero.com/enable-openssh-server-windows-10/
--
https://mail.python.org/mailman/listinfo/python-list


Re: curses apps on MS Windows?

2021-06-14 Thread Terry Reedy

On 6/13/2021 1:44 PM, Grant Edwards wrote:


Does windows have a terminfo/termcap subsystem to deal with different
terminal types? 


No. AFAIK


Or do the apps only work with the built-in terminal
windows implemented by command.com/cmd.exe?


The windows console is implemented by separate code.  It is used Command 
Prompt, Powershell, Python, and other test-mode console applications.


I can't answer other questions.  I imagine that *nix-like operations, 
one best use WSL? (Windows Subsystem for Linux?) or a Windows Bash 
imitation (Git bash, for instance).  I believe git bash uses the same 
console as its interface.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list