Skip to content

fix(graphics): decide a kitty placement's cursor move by P= and U= values - #875

Merged
vyncint merged 2 commits into
vyncint:mainfrom
alvaroalonsoparrondo-a11y:fix/kitty-cursor-move-by-value
Nov 27, 2026
Merged

vyncint merged 2 commits into
vyncint:mainfrom
alvaroalonsoparrondo-a11y:fix/kitty-cursor-move-by-value

Conversation

@alvaroalonsoparrondo-a11y

Copy link
Copy Markdown
Contributor

Fixes #844

Whether a kitty placement moves the cursor was value(b"C") != 1 && value(b"U") != 1 && key(control, b"P").is_none(): P= counted by its presence and U= only at 1. kitty's handle_put_command reads both by value: a placement is relative only with a nonzero parent id, virtual with any nonzero unicode_placement, and moves the cursor when cursor_movement != 1 and it is not virtual. So P=0 (a client that writes every key, defaults included) lost its cursor move, and U=2 moved the cursor.

  • crates/termlens/src/graphics.rs: moves is now C != 1 && U == 0 && P == 0. The field's rustdoc says the keys are read by value.
  • Docs: "C=1, U=1 or P=" becomes "C=1, a nonzero U= or a nonzero P=" in emu/vt100.rs (image_step) and docs/DESIGN.md. I left the 0.11.x CHANGELOG entry as it was released.
  • Tests:
    • unit test p_and_u_decide_the_cursor_move_by_value in graphics.rs: P=0 and U=0 move, U=2 and P=1 do not. The existing C=1 / U=1 / P=2 cases still pass.
    • the issue's case end to end in tests/graphics.rs, with the same name: X lands at 1,3 after P=0 and at 0,0 after U=2. Ignored on Windows like the test beside it (Unix only: what Windows support would actually take #149).
    • With the old condition both fail (left: Some((0, 0)), right: Some((1, 3)) for P=0).
  • CHANGELOG: entry under Unreleased → Fixed.

Checked on macOS: cargo fmt --all --check, cargo clippy -p termlens --all-targets --all-features -- -D warnings, cargo test -p termlens --lib for the placement tests, cargo test -p termlens --all-features --test graphics (13 passed), check-dco.sh and check-no-ai-attribution.sh.

Álvaro Alonso
242080768+alvaroalonsoparrondo-a11y@users.noreply.github.com

…lues

Fixes vyncint#844

Signed-off-by: Álvaro Alonso <242080768+alvaroalonsoparrondo-a11y@users.noreply.github.com>
vyncint
vyncint previously approved these changes Nov 27, 2026

@vyncint vyncint left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against the issue; CI is green. Thank you.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
@vyncint
vyncint merged commit 922d5c6 into vyncint:main Nov 27, 2026
17 checks passed
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.

A kitty placement with P=0 does not move the cursor and one with U=2 does; kitty does the opposite

2 participants