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

console_win: Try VIRTUAL_TERMINAL_PROCESSING aka modeVtOutput first and switch to alternate screen processing #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.)

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