Skip to content

Conversation

@davidrg
Copy link
Owner

@davidrg davidrg commented Oct 27, 2025

This is the result of a quick investigation to see how easy or hard it is to implement this. I've not decided if its actually worth having yet, so this PR is just to keep track of the work done so far in case I decide to finish it of later

So far the code here implements DECDRLBR, DECERLBRP, and DECERLBRA which seem to be working ok:
image
I've checked the behaviour against the Interaction of Ruled Lines and Other DECterm Escape Sequences table in the documentation - only DECDWL, DECDHL and ED-2 (erase screen) are not behaving correctly at the moment.

The implementation at this stage:

  • Does not try to replicate the crazy ruled line copy-to-the-left behaviour DECterm shows as I expect this is a bug
  • Does not require five parameters for DECERLBRA when erasing the entire screen - also assumed to be a bug
  • Does report extension 43 in DA1 - the documentation clearly says DECterm should do this, so the fact it isn't must be a bug
  • Uses an extra 1 byte per character cell, or ~258KB of extra RAM with the default scrollback size in a 32bit build
  • Is only available for K95G, though it seems the Windows console host has a similar feature (COMMON_LVB_GRID_*) so it might be possible to support it in the console version but probably not worthwhile. This restriction means it doesn't impact memory use of the OS/2 version, or the Windows console version.

If ruled lines are to be supported, then at a minimum the following still needs to be done to finish it off:

  • Form Feed (Ctrl+L) and ED-2 should preserve ruled lines on the screen. I can imagine this being a bit of a pain to implement as these are currently implemented by effectively scrolling all lines on screen up via function clrscreen - possibly a snapshot of the lines will need to be taken first, then restored afterwards, as trying to copy the attributes from scrollback won't work if scrollback is disabled.
  • DECDWL and DECDHL should not affect ruled lines (they shouldn't be stretched like they are now). The rendering code probably needs to be moved to after DECDWL/DECDHL are applied, which means looping throught he workstore a second time. For the sake of efficiency this should not be done if no ruled lines were detected in the first trip through the workstore.
  • Control sequences documentation

There are also some more questions that need to be answered by further testing against DECterm:

  • What defines the colour of ruled lines? Are they always white or are they affected by text colour?
  • Can you draw ruled lines on the individual cells that make up double-height/wide lines? Eg, a line through the middle?
  • Does erase-in-area require the area to be specified always, or just for erase in screen? Does printf '\x1b[15;;;;,t' do anything?
  • Does draw ruled lines have a default area? does printf '\x1b[15;;;;,r' do anything?
  • Same question for erase ruled lines - does printf '\x1b[15;;;;,s' do anything?
  • Do ruled lines scroll normally in LRMM (does DECterm have LRMM)?
  • How exactly do ruled lines interact with double-height/double-wide lines.
  • Are these control sequences affected by page cursor coupling? DECterm does support paging.
  • Would be good to do some tests against an older version of DECterm to see if some of the bugs disappear

DECDRLBR, DECERLBRP, and DECERLBRA are all implemented and seem to be working. The device attribute extension is reported. Behaviour matches "Interaction of Ruled Lines and Other DECterm Escape Sequences" except for ED, DECDWL and DECDHL.

At a minimum the following still needs to be done:
 * Form Feed (Ctrl+L) and ED-2 should preserve ruled lines on the screen
 * DECDWL and DECDHL should not affect ruled lines (they shouldn't be stretched like they are now)
 *  Control sequences documentation
@davidrg davidrg linked an issue Oct 27, 2025 that may be closed by this pull request
DECterm ruled lines are not supposed to be affected by double-height/double-wide lines, so draw them after dealing with those so they don't get stretched along with the text.
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.

DECterm Ruled Lines

2 participants