[FEATURE] Render cursor positioning and display erase for native pagers #3

Closed
opened 2026-10-24 01:12:10 +02:00 by erikinkinen · 1 comment
Owner

Problem and motivation

The native manual pager redraws with CSI H followed by CSI 2J. LibConsole consumes
both sequences without applying them, leaving the previous page on screen.

Proposed behavior and scope

Add ordinary-terminal cursor positioning (CUP, CSI row;column H, default 1;1)
and whole-display erase (ED, CSI 2J). Coordinates are one-based and clamp to
actual geometry. Empty or zero coordinates use the default. Erase the visible
text cells in the selected background without moving the cursor.

Keep framebuffer rendering and geometry-only cursor tracking consistent across
fragmented writes. Preserve the caret overlay, framebuffer padding/trailing bytes,
malformed-sequence refusal and route-boundary resets.

Authority, security and reliability

These controls act only on the framebuffer already borrowed by the ordinary
terminal renderer. They add no endpoint, mapping, lookup, mode or session authority.
Trusted/log text continues to bypass ordinary escape decoding. Unsupported or
malformed parameter forms must not partially move the cursor or erase pixels.

Acceptance criteria

  • Implement bounded CUP parsing/defaults/clamping and ED2 without cursor movement.
  • Keep actual framebuffer and geometry-only decoding consistent for all fragments.
  • Preserve padding/trailing memory and caret pixels; reject malformed/overflow input.
  • Cover native pager redraw and trusted-writer boundary behavior with meaningful controls.
  • Document the supported subset and its authority boundary.

Alternatives and tradeoffs

Repainting with repeated relative movement and row erasure would force each pager
to work around missing common display controls. These two standard operations fit
the existing allocation-free decoder and renderer.

Tracking and rollout

Supports native man and
terminal geometry.
The semantics follow ECMA-48, CUP and ED.
Update the existing LibConsole review and Integration supplier together.

## Problem and motivation The native manual pager redraws with CSI H followed by CSI 2J. LibConsole consumes both sequences without applying them, leaving the previous page on screen. ## Proposed behavior and scope Add ordinary-terminal cursor positioning (CUP, CSI row;column H, default 1;1) and whole-display erase (ED, CSI 2J). Coordinates are one-based and clamp to actual geometry. Empty or zero coordinates use the default. Erase the visible text cells in the selected background without moving the cursor. Keep framebuffer rendering and geometry-only cursor tracking consistent across fragmented writes. Preserve the caret overlay, framebuffer padding/trailing bytes, malformed-sequence refusal and route-boundary resets. ## Authority, security and reliability These controls act only on the framebuffer already borrowed by the ordinary terminal renderer. They add no endpoint, mapping, lookup, mode or session authority. Trusted/log text continues to bypass ordinary escape decoding. Unsupported or malformed parameter forms must not partially move the cursor or erase pixels. ## Acceptance criteria - [x] Implement bounded CUP parsing/defaults/clamping and ED2 without cursor movement. - [x] Keep actual framebuffer and geometry-only decoding consistent for all fragments. - [x] Preserve padding/trailing memory and caret pixels; reject malformed/overflow input. - [x] Cover native pager redraw and trusted-writer boundary behavior with meaningful controls. - [x] Document the supported subset and its authority boundary. ## Alternatives and tradeoffs Repainting with repeated relative movement and row erasure would force each pager to work around missing common display controls. These two standard operations fit the existing allocation-free decoder and renderer. ## Tracking and rollout Supports [native man](https://git.erikinkinen.fi/erix/coreutils/issues/4) and [terminal geometry](https://git.erikinkinen.fi/erix/coreutils/issues/7). The semantics follow [ECMA-48, CUP and ED](https://ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf). Update the existing LibConsole review and Integration supplier together.
Author
Owner

dacc83ca implements CUP and ED2 through the existing bounded decoder. Cursor positioning handles omitted/zero coordinates and clamps to geometry; display erase keeps the cursor, caret custody and padding intact. Literal trusted/log rendering keeps its existing path. Integration adoption is being coordinated with the manual work.

[dacc83ca](https://git.erikinkinen.fi/erix/lib-console/commit/dacc83ca463ccae42f12a73e4621e4ae3c8b2ff5) implements CUP and ED2 through the existing bounded decoder. Cursor positioning handles omitted/zero coordinates and clamps to geometry; display erase keeps the cursor, caret custody and padding intact. Literal trusted/log rendering keeps its existing path. Integration adoption is being coordinated with the manual work.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:38 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/lib-console#3
No description provided.