Skip to content

fix(graphics): ignore a sixel colour in an unknown colour space - #873

Merged
vyncint merged 2 commits into
vyncint:mainfrom
alvaroalonsoparrondo-a11y:fix/sixel-unknown-colour-space
Nov 27, 2026
Merged

vyncint merged 2 commits into
vyncint:mainfrom
alvaroalonsoparrondo-a11y:fix/sixel-unknown-colour-space

Conversation

@alvaroalonsoparrondo-a11y

Copy link
Copy Markdown
Contributor

Fixes #846

decode_sixel refused every colour space but RGB with sixel HLS colours, so #1;3;10;20;30 or #1;0;… failed with a message about HLS, which is only colour space 1.

  • crates/termlens/src/graphics.rs: the definition is matched on its colour space. 1 (HLS) is still refused, 2 (RGB) is applied as before, and any other space is ignored, leaving the register as it was. That is what xterm does: it treats any other space as a DATA_ERROR and skips update_color_register (graphics_sixel.c:799-803). The register is still selected, so the image draws in its earlier colour.
  • Test: a_colour_in_an_unknown_space_leaves_the_register_as_it_was: register 1 defined blue then redefined in space 0 or 3 paints blue, and an undefined register redefined in space 3 keeps its VT340 default. It fails without the change (the decode returns Unsupported). hls_colours_are_refused_rather_than_converted still passes.
  • 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 --features decode --lib for the sixel colour tests, check-dco.sh and check-no-ai-attribution.sh.

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

Fixes vyncint#846

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 67fd066 into vyncint:main Nov 27, 2026
17 checks passed
vyncint added a commit to alvaroalonsoparrondo-a11y/termlens that referenced this pull request Nov 27, 2026
Combine the range check with vyncint#873's colour-space match: a component
over 100 is ignored inside the RGB arm. Keep both tests, and the
CHANGELOG entries without a blank line between them.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
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 sixel colour in a colour space other than HLS or RGB is refused as "sixel HLS colours"

2 participants