Skip to content

Conversation

@JoeKar
Copy link

@JoeKar JoeKar commented Dec 20, 2023

According to @DHowett (maintainer for the Windows Console subsystem and the Terminal)...

In my opinion, all applications should use VIRTUAL_TERMINAL_PROCESSING mode first and only fall back to the legacy ways if they need to!

...so we should try to activate modeVtOutput regardless if truecolor is set or not and switch then into the alternate screen mode (ported from tscreen and terminfo of xterm). Only then we can fix the ugly effect reported with the issue this PR tries to solve. With the change I wasn't able to reproduce this under Windows any longer.

Still something is happening with the terminal style when micro is closed:

  • The Windows Terminal prompt then still uses the background color of micro, till the screen is cleared.
  • The previous history isn't available any longer.

Fixes zyedidia/micro#3073

@gdamore
This is most probably something which can/should be considered upstream too.

PS:
@zyedidia & @gdamore
Maybe there is a chance to bundle the competence and efforts again upstream so micro doesn't need to rely on his own fork any longer. Just my thoughts. 😉

@gdamore
Copy link

gdamore commented Feb 1, 2024

So the issue with switching to the VTE by default is that we also really need to use the extended key mode so that we can unambiguously get keystrokes. Otherwise it will be a reduction in functionality.

Its on my list.

@gdamore
Copy link

gdamore commented Feb 1, 2024

I do like the approach here though!

@DHowett
Copy link

DHowett commented Feb 1, 2024

So the issue with switching to the VTE by default is that we also really need to use the extended key mode so that we can unambiguously get keystrokes. Otherwise it will be a reduction in functionality.

Its on my list.

That's alright! Opting for VT emulation mode on output doesn't require you to opt in for input. A Windows console application can receive higher-fidelity INPUT_RECORD key events while still producing things like 24-bit color and using the alternate screen buffer. 😄

@gdamore
Copy link

gdamore commented Feb 20, 2024

Ah, cool. Yeah, using VTE only for output is actually a great idea. Let me look at this.

@gdamore
Copy link

gdamore commented Feb 20, 2024

Ah I remember now. ConEmu or one of the other terminal emulators didn't support this consistently. But maybe its better now.

@DHowett
Copy link

DHowett commented Feb 20, 2024

Whatever the case may be, I'm happy to help! Feel free to tag me on any issues or pull requests. 🙂

@gdamore
Copy link

gdamore commented Mar 2, 2024

So I've implemented this in a better and more complete way: gdamore#692

It has an override ability for the alternate screen buffer, and leaves the original undamaged, and disables this on ConEmu which is frankly too broken to use in VT mode. (I tested the most recent release of ConEmu first.)

@gdamore
Copy link

gdamore commented Nov 30, 2025

Upstream tcell now only uses VT mode. For both output AND input!

ConEmu sort of works, but I really don't recommend it (its kind of abandonware anyway) -- and all the other Windows emulators work well from what I've been able to test.

I'd suggest exploring pulling in the new code. console_win in particular is utterly gone now, which does break Windows versions older than Windows 10 Creators Update (1704 I think) -- so it breaks Windows 8 and earlier, as well as Windows 10 older than 2017. I cannot imagine wanting to support such ancient builds of Windows, as they are fundamentally insecure.

@gdamore
Copy link

gdamore commented Nov 30, 2025

Btw, Windows Server 2016 should also work, but I don't have a way to test that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

micro shows previous mangled text when scrolling up after resizing the terminal

3 participants