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

Basic xterm emulation #201

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft

Basic xterm emulation #201

wants to merge 20 commits into from

Conversation

davidrg
Copy link
Owner

@davidrg davidrg commented May 11, 2023

This is an attempt at a usable emulation of xterm. In particular, a terminal type that passes most of the tests in esctest2 (https://github.com/ThomasDickey/esctest) and supports a reasonable subset of xterms extensions. The goal is maximum achievable compatibility with xterm, enough that using TERM=xterm doesn't cause any issues for a vast majority of applications.

Why? Because CKW has only emulation options. There is no "ckw" terminal type that turns on all available features, and even if there were there is the challenge of getting that terminal type into every terminfo database on every machine in the world. Faced with this same challenge a lot of other terminal emulators, eg PuTTY, just claim to be xterm. We're going to aim to do a better job of matching xterms behaviour though.

In order to be merged:

In order to be in a releasable state, the xterm emulation option really needs to support:

  • A significant majority of esctest2 test cases
  • The double-underlined character attribute
  • The crossed-out character attribute
  • DEC Locator mode
  • Alternate screen buffer #231
  • DECLRMM and DECSLRM - set left/right margins #232 - set left/right margins (VT420)
  • DECRQCRA - request checksum of rectangular area (VT420), off by default and enabled with set term send-data on
  • The same keymap as xterm
  • Any xterm escape sequences we don't support should at least be stubbed out to ensure they do nothing rather than doing the wrong thing.

It would also be nice to support these extensions and other features, though perhaps not strictly necessary for a first version:

We also need to document what exactly the "xterm" terminal type is:

  • What percentage of esctest2 we pass
  • Which specific xterm features we do not implement and how CKW handles them. The list should be short enough that documenting it isn't too much of a problem.
  • Any features the xterm emulation option supports that xterm does not implement (eg, PC Term mode)

We should also probably sort out some other emulation issues while we're here:

  • Emulating xterm is going to bring in a significant number of VT420 features. Perhaps its worth finally adding a VT420 emulation option
  • Might be worthwhile providing a "ckwterm" emulation type that just turns on as many features as possible. Maybe someday it makes its way into terminfo and we don't have to pretend to be xterm anymore.

Not enabled by default (build with CKF_XTERM_EMULATION=yes

Also made it possible to build with VT420 and VT520 emulation options (in theory), though there is currently no VT520 stuff implemented and very little VT420 so not much point in turning these on.
Certain escape sequences were probably able to trigger and out-of-bounds array access.
Perhaps some later VT terminals do too?

The xterm paths haven't been implemented yet but at least the wrong thing won't happen now if something tries to do, eg, double-underline.
Now passes all tests
@davidrg davidrg added feature terminal-emulation Updates to existing emulations, or addition of new ones labels May 11, 2023
@davidrg davidrg added this to the Some Future Release milestone Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature terminal-emulation Updates to existing emulations, or addition of new ones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant