|
From: | Jim Porter |
Subject: | Re: Terminal emulator in Windows |
Date: | Wed, 11 Jan 2023 11:52:03 -0800 |
On 1/11/2023 10:26 AM, Akib Azmain Turja wrote:
Jim Porter <jporterbugs@gmail.com> writes:On 1/11/2023 1:35 AM, Akib Azmain Turja wrote:In general, is it possible to implement Windows terminal emulation?Do you mean "emulating cmd.exe" or "emulating a terminal and running that emulator on MS Windows"? The former might be trickier, and II started the thread, and even I don't know. But I guess the latter. For more information, you may check the Eat issue 35 on Codeberg: https://codeberg.org/akib/emacs-eat/issues/35
In some ways this issue actually sounds more like the former. It sounds like the user wants something like ConEmu[1] in Emacs. ConEmu's implementation seems pretty hacky to me, since it relies on an invisible Windows Console window[2].
On the other hand, there's the new-ish MS Windows API called ConPTY (as the name implies, it gives you a pseudoterminal). This would give us similar benefits compared to what ConEmu does, but using an explicitly-supported API for it. This would be nice, since then Emacs could just use pseudoterminals everywhere, which I think is what we want. Unfortunately, it seems that this API isn't suitable for Emacs, as discussed here[3] by Eli.
haven't really looked into how you'd do that. However, the latter might just mean handling VT100 terminal sequences, which I don't think would require knowing about any Windows-specific features/APIs.But somehow we need to tell the program what escape sequences to send, don't we?
From this discussion[4], it's the *program* that decides to opt in to sending VT100 sequences to a Windows console. That is, if I wrote a cross-platform program that uses VT100 sequences, I'd call 'SetConsoleMode' with 'ENABLE_VIRTUAL_TERMINAL_PROCESSING' in my MS Windows port. Maybe Emacs could piggyback off of that.
I don't know if this would help solve the issue in the bug you linked, but maybe something like this would work for handling VT100 sequences in Eshell via 'eat-eshell-mode', or when running *nix programs remotely through Tramp.
[1] https://conemu.github.io/ [2] https://conemu.github.io/en/RealConsole.html [3] https://github.com/microsoft/terminal/issues/9174 [4] https://news.ycombinator.com/item?id=25866634
[Prev in Thread] | Current Thread | [Next in Thread] |