Implement generalised image support

Support Kitty and SIXEL input and output with grid-resident image layers, history and copy-mode integration, text fallback rendering, and damage-rectangle redraws.

Consolidate the image work through 250f96b4b onto the redraw-damage-rectangles-new base, excluding the superseded redraw implementation and its historical merges. The original history is preserved in backup/4902-image-support-before-master-rebase-20261003.
This commit is contained in:
Michael Grant
2026-10-03 22:46:01 +01:00
parent 9286115b43
commit cfd1b81dc7
44 changed files with 7586 additions and 677 deletions

View File

@@ -236,9 +236,11 @@ static const struct tty_feature tty_feature_strikethrough = {
0
};
#define TTY_FEATURE_SYNC "Sync=\\E[?2026%?%p1%{1}%-%tl%eh%;"
/* Terminal supports synchronized updates. */
static const char *const tty_feature_sync_capabilities[] = {
"Sync=\\E[?2026%?%p1%{1}%-%tl%eh%;",
TTY_FEATURE_SYNC,
NULL
};
static const struct tty_feature tty_feature_sync = {
@@ -369,6 +371,50 @@ static const struct tty_feature tty_feature_sixel = {
TERM_SIXEL
};
/* Terminal has Kitty graphics protocol Unicode placeholder capability. */
static const char *const tty_feature_kitty_capabilities[] = {
"Kty",
TTY_FEATURE_SYNC,
NULL
};
static const struct tty_feature tty_feature_kitty = {
"kitty",
tty_feature_kitty_capabilities,
TERM_KITTY
};
#ifdef ENABLE_IMAGES
static const char *const tty_feature_image_capabilities[] = {
NULL
};
static const struct tty_feature tty_feature_image_quadrants = {
"image-quadrants",
tty_feature_image_capabilities,
TERM_IMAGE_QUADRANTS
};
static const struct tty_feature tty_feature_image_sextants = {
"image-sextants",
tty_feature_image_capabilities,
TERM_IMAGE_SEXTANTS
};
/*
* Terminal moves SIXEL or Kitty image content along with the rest of a
* scrolling region, rather than needing it redrawn after every scroll.
* There is no way to ask a terminal this, and it does not correlate with
* DECSLRM/margins support - confirmed by direct testing that mintty
* scrolls text within a margin-bounded region correctly but drops sixel
* content placed there, while WezTerm and Windows Terminal move it
* correctly - so this is granted per terminal individually rather than
* assumed from any other capability.
*/
static const struct tty_feature tty_feature_imagescroll = {
"imagescroll",
tty_feature_image_capabilities,
TERM_IMAGESCROLL
};
#endif
/* Terminal supports the OSC 9;4 progress bar. */
static const char *const tty_feature_progressbar_capabilities[] = {
"Spb=\\E]9;4;%p1%d;%p2%d\\E\\\\",
@@ -399,6 +445,12 @@ static const struct tty_feature *const tty_features[] = {
&tty_feature_extkeys,
&tty_feature_focus,
&tty_feature_ignorefkeys,
&tty_feature_kitty,
#ifdef ENABLE_IMAGES
&tty_feature_image_quadrants,
&tty_feature_image_sextants,
&tty_feature_imagescroll,
#endif
&tty_feature_margins,
&tty_feature_mouse,
&tty_feature_osc7,
@@ -637,7 +689,9 @@ tty_default_features(struct client *c, const char *name, u_int version)
"extkeys,"
"focus,"
"hyperlinks,"
"imagescroll,"
"margins,"
"sixel,"
"usstyle"
},
{ .name = "ghostty",
@@ -646,13 +700,28 @@ tty_default_features(struct client *c, const char *name, u_int version)
"cstyle,"
"extkeys,"
"focus,"
"imagescroll,"
"margins,"
"overline,"
"hyperlinks,"
"osc7,"
"sync,"
"usstyle,"
"progressbar"
"progressbar,"
"kitty"
},
{ .name = "kitty",
.features = TTY_FEATURES_BASE_MODERN_XTERM ","
"ccolour,"
"cstyle,"
"extkeys,"
"focus,"
"hyperlinks,"
"imagescroll,"
"osc7,"
"sync,"
"usstyle,"
"kitty"
},
{ .name = "Rio",
.features = TTY_FEATURES_BASE_MODERN_XTERM ","