Skip to content

Support HVP cursor positioning#34

Open
rezigned wants to merge 2 commits into
doy:mainfrom
rezigned:fix/hvp-cursor-position
Open

Support HVP cursor positioning#34
rezigned wants to merge 2 commits into
doy:mainfrom
rezigned:fix/hvp-cursor-position

Conversation

@rezigned

Copy link
Copy Markdown
Contributor

Support HVP cursor positioning

Summary

  • Handle CSI Ps ; Ps f (HVP) as an alias of CSI Ps ; Ps H (CUP).
  • Preserve the existing one-based row and column defaults through canonicalize_params_2.
  • Add regression coverage for explicit HVP coordinates and the default home position.

Problem

HVP is the ANSI horizontal and vertical position command. It has the same cursor-positioning behavior as CUP, but the parser only dispatched the H final byte. Applications that use f for absolute cursor movement therefore had their cursor commands ignored.

This is visible with btop, which uses HVP throughout its redraw output. Ignoring those commands causes drawing payloads to be written sequentially and wrap across rows instead of appearing at their requested coordinates.

Fix

Dispatch both final bytes to the existing CUP implementation:

'H' | 'f' => {
    self.screen.cup(canonicalize_params_2(params, 1, 1))
}

No new screen behavior or parser state is introduced.

Verification

cargo fmt --check
cargo test --test csi horizontal_vertical_position
cargo test

Results:

  • Focused HVP regression: 1 passed
  • Full vt100 suite: 71 passed, 4 ignored
  • Downstream upmd suite using the pinned fork revision: 159 passed, 1 ignored
  • Manual downstream check: btop renders at the correct cursor coordinates

@rezigned
rezigned force-pushed the fix/hvp-cursor-position branch from 8a35571 to a58cbf7 Compare July 12, 2026 06:15
@rezigned
rezigned force-pushed the fix/hvp-cursor-position branch from 9baf1fb to e984df3 Compare July 12, 2026 06:45
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.

1 participant