[FEATURE] Follow the native terminal size in man #7

Open
opened 2026-10-24 01:09:45 +02:00 by erikinkinen · 1 comment
Owner

Problem and motivation

The internal pager uses 24 logical lines unless the caller supplies --lines.
It should use the actual terminal height and adapt when that terminal resizes.

Proposed behavior and scope

When both standard streams are authenticated fixed terminal aliases, read the
existing PTY state through the original input endpoint. Use its current row
count for the viewport and refresh it before navigation can block or move.
Keep --lines as an explicit caller-selected override. Redirected and pipeline
output remains plain text and must not query terminal state or consume input.

Preserve position, search state and queued input when dimensions change. Reserve
space for the pager prompt and define behavior for a terminal with one row.

Authority, security and reliability

Use the existing receipt-free READ_STATE operation on the already selected input
SEND capability. Validate its exact live session/primary PTY and response framing,
correlation, lifecycle, dimensions and generation. A pathname, environment value
or terminal name must never select a new object or create a grant.

Do not consume the session's shared event cursor, request RESIZE/SET_MODE rights,
or acquire another lifecycle endpoint. Preserve original read/output errors,
lease retirement and buffer clearing on state failure or terminal hangup.

Acceptance criteria

  • Define initial geometry, prompt accounting, resize and --lines precedence.
  • Query and validate the exact original terminal state without adding grants.
  • Preserve position/search and post-quit input across size changes.
  • Cover malformed/stale/denied state, tiny dimensions, failures and plain output.
  • Add native terminal fixture sources and update command/component/manual prose.

Alternatives and tradeoffs

Environment variables and display-control queries cannot authenticate the terminal
object. Reusing the existing read-only state operation also avoids taking the
shared resize-event cursor away from another session consumer.

Tracking and rollout

Extends the native manual reader.
Coordinate Coreutils PR2,
Integration PR12 and the
phase completion checklist.

## Problem and motivation The internal pager uses 24 logical lines unless the caller supplies --lines. It should use the actual terminal height and adapt when that terminal resizes. ## Proposed behavior and scope When both standard streams are authenticated fixed terminal aliases, read the existing PTY state through the original input endpoint. Use its current row count for the viewport and refresh it before navigation can block or move. Keep --lines as an explicit caller-selected override. Redirected and pipeline output remains plain text and must not query terminal state or consume input. Preserve position, search state and queued input when dimensions change. Reserve space for the pager prompt and define behavior for a terminal with one row. ## Authority, security and reliability Use the existing receipt-free READ_STATE operation on the already selected input SEND capability. Validate its exact live session/primary PTY and response framing, correlation, lifecycle, dimensions and generation. A pathname, environment value or terminal name must never select a new object or create a grant. Do not consume the session's shared event cursor, request RESIZE/SET_MODE rights, or acquire another lifecycle endpoint. Preserve original read/output errors, lease retirement and buffer clearing on state failure or terminal hangup. ## Acceptance criteria - [ ] Define initial geometry, prompt accounting, resize and --lines precedence. - [ ] Query and validate the exact original terminal state without adding grants. - [ ] Preserve position/search and post-quit input across size changes. - [ ] Cover malformed/stale/denied state, tiny dimensions, failures and plain output. - [ ] Add native terminal fixture sources and update command/component/manual prose. ## Alternatives and tradeoffs Environment variables and display-control queries cannot authenticate the terminal object. Reusing the existing read-only state operation also avoids taking the shared resize-event cursor away from another session consumer. ## Tracking and rollout Extends the [native manual reader](https://git.erikinkinen.fi/erix/coreutils/issues/4). Coordinate [Coreutils PR2](https://git.erikinkinen.fi/erix/coreutils/pulls/2), [Integration PR12](https://git.erikinkinen.fi/erix/integration/pulls/12) and the [phase completion checklist](https://git.erikinkinen.fi/erix/integration/issues/65).
Author
Owner

Physical-row paging is implemented in f9eb4439: long lines reflow at the observed width, UTF-8 scalars occupy one native cell, resize retains the source position and backward search finds overlapping matches. Tiny screens use an explicit bounded fallback. The matching owner-driven resize route and guest fixture are being wired separately; man retains only its existing store READ and terminal READ_STATE access.

Physical-row paging is implemented in `f9eb4439`: long lines reflow at the observed width, UTF-8 scalars occupy one native cell, resize retains the source position and backward search finds overlapping matches. Tiny screens use an explicit bounded fallback. The matching owner-driven resize route and guest fixture are being wired separately; man retains only its existing store READ and terminal READ_STATE access.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:35 +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/coreutils#7
No description provided.