-
Couldn't load subscription status.
- Fork 18
Alternate Screen and VT paging #495
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These changes *should* be enough to support implementing both xterms alternate screen, and DECs page memory extension. Might be enough to implement paging support for other terminals that have such a feature too. These changes have only been tested to the extent that the xterm alternate screen feature needs them - there may well be bugs that turn up when page cursor coupling is turned off. Allocating a bunch of pages for VTERM whether or not the current terminal emulation supports them is a bit wasteful on memory too. Would be nice to have a SET TERM PAGES command or similar. *Ideally* pages would only be allocated when first used too, but the way VscrnSetBufferSize works makes that too difficult right now.
This should implement all of xterms alternate screen feature except for DECSET-47 as that conflicts with DECGRCM and I've not decided yet which of the two definitions for this mode I'd like the K95 terminal type to implement. It has been lightly tested and seems to work OK. Behaviour for all four modes seems to match xterm. Due to the nature of the change, and the significant set of changes to enable paging that this is built on, it could really do with some solid testing. Closes #231
Closed
I didn't really like that macro anyway...
when switching away from page 0. For some reason this didn't seem to happen when switching to the alternate buffer which is odd. Perhaps related to the issue where the horizontal scrollbar would partially come to life for some non-obvious reason. Not sure what is special about page 10 to cause that.
Kermit 95 can now move around the available pages. These control sequences are not available while on the alternate screen, and they can not be used to access the alternate screen (which is really just a bonus page that's treated specially).
Seems to work OK in my brief testing. More extensive testing will be required later to ensure all of the various functions like mark/copy, search, etc, still work while the cursor is on a different page from the one on screen.
We support enough of it now that its probably reasonable to do this, and the remaining bits that aren't supported will follow along soon.
j4james
reviewed
Oct 18, 2025
This reverts commit 3473585.
Closed
And, while I'm here, also make it work properly: it should now respect DECOM, and also copy attributes. The demo script has also been updated to make use of both per-page margins and DECCRA to copy a string from another page. Conveniently with the exception of colour and the strike-through attribute Kermit 95 matches what my VT520 does, while every other terminal is broken in some way.
As Kermit 95 doesn't support multiple sessions, this currently just restricts the number of pages available to applications. It can be requested via DECRQSS.
Print Composed Main Display, and Print All Pages.
Should have tested that commit first...
This should speed up changes to background page slightly. I've only bothered making this change to control sequences that are implemented by a VT420 or similar - a few SCO and ANSI control sequences were left alone. Also fixed the scrollback getting disabled when the cursor was on a different page while PCCM wasoff.
No point wasting memory allocating 10 pages if the user is just emulating something like an H19 which only has one.
But only when its not on page 1, and show an 'A' when its on the alternate screen. This required enlarging the panel in the status bar slightly.
While this isn't really intended as a kind of torture test, its nice if it happens to show VT features that K95 implements properly that other terminals get wrong. And every other terminal I have handy gets at least *something* wrong here - only K95 and my trusty VT520 can do it properly (though of course without colour on the VT520)
SET TERM PAGE can be used to change the cursor page, turn page cursor coupling on/off, and to set the total number of available pages.
Not really related to paging, but it is part of the windowing feature and its easy to do. Reduced a bit of duplicate code in the process.
As it *really* breaks stuff in most terminals, and its a bit unfair as most don't even attempt to implement it. Rectangular area options, which also breaks stuff in most terminals surprisingly, is still always on.
Otherwise, if the terminal is viewing scroll back when switching to another page you end up with a blank terminal
This was probably also an issue if the remote host turned off the cursor - it would also end up being turned off during mark mode making it rather difficult to use.
Sometimes when switching pages the console mode renderer wasn't refreshing the screen until some other event (eg, a keypress) set the dirty flag again. Adding a brief pause after switching pages seems to help.
with the way DECSSDT works for the VT520 and K95 terminal types. This fixes the temporary status line not appear when the status line has been turned off via command rather than DECSSDT.
Because I do not fully understand why the previous version did not work in 24bit colour builds. But this seems to work correctly, so it will do until this whole function is eventually rewritten to be more reasonable.
And certainly not a mix of both!
Mostly making sure consistent use of page numbers.
about an undeclared function. Could cause issues on 64bit windows.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The primary goal of this PR is to implement the Xterm alternate screen, something that all other terminals maintained in the last 20 years support now. But as that is really just a subset of the VT paging feature, thats being implmented here too with the Xterm alternate screen implemented as an additional page with some special rules around it (can't get to/from it via VT paging control sequences, etc).
While the changes involved are much more extensive than the last attempt at the alternate screen feature (#244), I think crossing off another VT420 feature is worth it plus there should be less opportunity for weird bugs and unnoticed array out-of-bounds problems than trying to add a second terminal vscreen and trying to make them both share a single input queue, etc.
While K95 does emulate other terminals that support paging (WY370 at least), paging support won't be attempted for those at the moment due to both a lack of hardware and software to test against, and a lack of users to report bugs.
Implementation:
And Testing - in particular make sure having the cursor on some other page with PCCM disabled doesn't break things that should act on the view page: