Kitty graphics #20872
<!-- AzurePipelinesStatusComment -->
<samp>
Azure Pipelines:<br>
There may be pipelines that require an authorized user to comment /azp run to run.<br>
</samp>
check-spelling / Unrecognized Spelling
[letterboxed](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[LPto](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[BLENDFUNCTION](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[XTVERSION](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mapview](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mbi](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mbi](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mbi](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mbi](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[mbi](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[Bytef](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[PBGRA](#security-tab) is not a recognized word
check-spelling / Forbidden Pattern
[non-existent](#security-tab) matches a line_forbidden.patterns rule: Should be 'nonexistent' - '\\\b\[Nn\]o\[nt\]\[- \]existent\\\b'
check-spelling / Unrecognized Spelling
[EBADPNG](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[XTVERSION](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[VERSIONINFO](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[XTVERSION](#security-tab) is not a recognized word
check-spelling / Unrecognized Spelling
[XTVERSION](#security-tab) is not a recognized word
check-spelling / Forbidden Pattern
[non-existent](#security-tab) matches a line_forbidden.patterns rule: Should be 'nonexistent' - '\\\b\[Nn\]o\[nt\]\[- \]existent\\\b'
check-spelling / Unrecognized Spelling
[XTVERSION](#security-tab) is not a recognized word
@check-spelling-bot Report
🔴 Please review
See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
Unrecognized words (10)
BLENDFUNCTION
Bytef
EBADPNG
letterboxed
LPto
mapview
mbi
PBGRA
VERSIONINFO
XTVERSION
<details><summary>These words are not needed and should be removed
</summary>ADDREF CLAUDE CLIPCHILDREN CLIPSIBLINGS DDESHARE otm PCWCH PSTR yizz
</details><p></p>
<details><summary>To accept these unrecognized words as correct and remove the previously acknowledged and now absent words,
you could run the following commands</summary>
... in a clone of the git@github.com:mbwilding/terminal.git repository
on the kitty-graphics branch ([ℹ️ how do I use this?](
https://docs.check-spelling.dev/Accepting-Suggestions)):
`` sh
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/41110534992/attempts/1' &&
git commit -m 'Update check-spelling metadata'
json</details>
<details><summary>Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary</summary>
This includes both **expected items** (2031) from .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and **unrecognized words** (10)
Dictionary | Entries | Covers | Uniquely
-|-|-|-
[cspell:cpp/src/lang-keywords.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/cpp/src/lang-keywords.txt)|44|3|3|
[cspell:csharp/csharp.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/csharp/csharp.txt)|32|2|2|
[cspell:cpp/src/compiler-clang-attributes.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/cpp/src/compiler-clang-attributes.txt)|46|2|2|
[cspell:aws/aws.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/aws/aws.txt)|218|2|2|
[cspell:python/src/python/python.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/python/src/python/python.txt)|392|2|2|
Consider adding to the `extra_dictionaries` array (in the `.github/actions/spelling/config.json` file):
"cspell:cpp/src/lang-keywords.txt",
"cspell:csharp/csharp.txt",
"cspell:cpp/src/compiler-clang-attributes.txt",
"cspell:aws/aws.txt",
"cspell:python/src/python/python.txt",
To stop checking additional dictionaries, put (in the `.github/actions/spelling/config.json` file):
json"check_extra_dictionaries": []
</details>
#### Forbidden patterns 🙅 (1)
In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.
These forbidden patterns matched content:
##### Should be `nonexistent`
\b[Nn]o[nt][- ]existent\b
`
<details><summary>Errors ❌ (1)</summary>
See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
❌ Errors | Count
-|-
❌ forbidden-pattern | 2
See ❌ Event descriptions for more information.
</details>
<!-- See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice --> <!-- markdownlint-disable MD033 MD041 -->
<details>
<summary>
:pencil2: Contributor please read this
</summary>
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
... misspelled, then please correct them instead of using the command.
... names, please add them to
.github/actions/spelling/allow/names.txt.
... APIs, you can add them to a file in .github/actions/spelling/allow/.
... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.See the
README.md in each directory for more information.:microscope: You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
<details><summary>If the flagged items are :exploding_head: false positives</summary>
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt file matching the containing file. File paths are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude [README.md](
../tree/HEAD/README.md) (on whichever branch you're using).well-formed pattern. If you can write a [pattern](
https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
) that would match it,
try adding it to the
patterns.txt` file. Patterns are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
</details>
</details>
Matthew Wilding (@mbwilding) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
>> @microsoft-github-policy-service agree [company="{your company}"] >
> > Options:
>
> (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
>
>> > @microsoft-github-policy-service agree > >
>
>
>
>
>
>
>
>
>
>
>
>
> (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
>
>> > @microsoft-github-policy-service agree company="Microsoft" > >
> Contributor License Agreement
@microsoft-github-policy-service agree
check-spelling / Unrecognized Spelling
[IHDR](#security-tab) is not a recognized word
@check-spelling-bot Report
🔴 Please review
See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
Unrecognized words (1)
IHDR
<details><summary>These words are not needed and should be removed
</summary>ADDREF CLAUDE CLIPCHILDREN CLIPSIBLINGS DDESHARE otm PCWCH PSTR yizz
</details><p></p>
<details><summary>To accept these unrecognized words as correct and remove the previously acknowledged and now absent words,
you could run the following commands</summary>
... in a clone of the git@github.com:mbwilding/terminal.git repository
on the kitty-graphics branch ([ℹ️ how do I use this?](
https://docs.check-spelling.dev/Accepting-Suggestions)):
`` sh
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/41115307580/attempts/1' &&
git commit -m 'Update check-spelling metadata'
json</details>
<details><summary>Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary</summary>
This includes both **expected items** (2039) from .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and **unrecognized words** (1)
Dictionary | Entries | Covers | Uniquely
-|-|-|-
[cspell:cpp/src/lang-keywords.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/cpp/src/lang-keywords.txt)|44|3|3|
[cspell:csharp/csharp.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/csharp/csharp.txt)|32|2|2|
[cspell:cpp/src/compiler-clang-attributes.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/cpp/src/compiler-clang-attributes.txt)|46|2|2|
[cspell:aws/aws.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/aws/aws.txt)|218|2|2|
[cspell:python/src/python/python.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/python/src/python/python.txt)|392|2|2|
Consider adding to the `extra_dictionaries` array (in the `.github/actions/spelling/config.json` file):
"cspell:cpp/src/lang-keywords.txt",
"cspell:csharp/csharp.txt",
"cspell:cpp/src/compiler-clang-attributes.txt",
"cspell:aws/aws.txt",
"cspell:python/src/python/python.txt",
To stop checking additional dictionaries, put (in the `.github/actions/spelling/config.json` file):
json"check_extra_dictionaries": []
`
</details>
<!-- See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice --> <!-- markdownlint-disable MD033 MD041 -->
<details>
<summary>
:pencil2: Contributor please read this
</summary>
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
... misspelled, then please correct them instead of using the command.
... names, please add them to
.github/actions/spelling/allow/names.txt.
... APIs, you can add them to a file in .github/actions/spelling/allow/.
... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.See the
README.md in each directory for more information.:microscope: You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
<details><summary>If the flagged items are :exploding_head: false positives</summary>
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt file matching the containing file. File paths are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude [README.md](
../tree/HEAD/README.md) (on whichever branch you're using).well-formed pattern. If you can write a [pattern](
https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
) that would match it,
try adding it to the
patterns.txt` file. Patterns are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
</details>
</details>
XTVERSION
absolutely not :)
How it works
FWIW, I would have hoped to see _something_ explaining the "placement diacritics" and stuff in this section. It seems like a pretty significant part of how it.. works.. 🙂
(blocking for direction review)
> How it works
> FWIW, I would have hoped to see _something_ explaining the "placement diacritics" and stuff in this section. It seems like a pretty significant part of how it.. works.. 🙂
They're part of the kitty unicode placeholders spec. the app prints U+10EEEE as normal text, the image id goes in the fg colour, the placement id in the underline colour, and the diacritics give the row/column (plus the top byte of the id if it needs it). since it's just text it scrolls and reflows like everything else, so tmux/nvim for example can move images around without knowing anything about the protocol. renderer decodes them per row and draws that part of the image under the text.
> XTVERSION
> absolutely not :)
Certain things rely on this for functionality as it identifies the terminal (admittedly some things use this value to apply work arounds for particular terminal emulators). For example the snacks image plugin for neovim will read this value. What's the aversion to having it as part of WT?
What's the aversion to having it as part of WT?
So, mostly on principle. There's a long discussion in both a PR which attempted to introduce it (https://github.com/microsoft/terminal/pull/20268) and the original feature request for it (https://github.com/microsoft/terminal/issues/18382), which I won't go all the way into here.
The TL;DR:
I don't think he knows about second user-agent, Pip.
No worries, I have removed the logic for XTVERSION.
If you want to have some good test/benchmark, you can use my music software that support kitty graphic rendering. rustel.cc (ctrl-o for settings > then choose kitty graphics in rendering mode)
I gave this PR a glance and I think this is generally the right direction. It may be worth basing our implementation on this PR out of the 3 we have. Perhaps unsurprisingly it requires significant polishing.
There's also some things that I have personal feelings on. For instance, I think that deflate compressed raw RGB is a particularly bad aspect of the Kitty protocol, to put it mildly.
_PNG is literally deflated RGB with a prefilter. Why on god's green earth would you not use it??_
I have a strong urge to ask you to remove its support, and similar blasphemous features, but I'm not entirely sure about that yet. 🫥
personally I feel that copies are worse than casts.
this seems like more of an antipattern than having a bounds.1 violation does
just some thoughts while commit 2917bdc went by my inbox
DHowett
mbwilding
Summary of the Pull Request
This adds support for the kitty graphics protocol to Windows Terminal and conhost. Tools that use the protocol, such as snacks.nvim's image viewer, can display images directly in Windows Terminal, including inline markdown images in Neovim.
<img width="1000" height="660" alt="terminal" src="https://github.com/user-attachments/assets/616b5454-f767-45e3-8250-143db3a69d97" />
<img width="1000" height="540" alt="neovim" src="https://github.com/user-attachments/assets/9890792f-fae6-4016-beb3-310e868b1a96" />
References and Relevant Issues
https://github.com/microsoft/terminal/issues/8389
Detailed Description of the Pull Request / Additional comments
What's supported
- cropping, scaling to a cell box with letterboxing, sub-cell offsets, cursor movement control and z-index layering;
- virtual placements with unicode placeholders, so images move with the text in applications like Neovim.
What isn't supported
Animation, relative placements and the palette-indexed formats (
f=8andf=16) reply with an error.New dependency
zlib is added to
vcpkg.jsonto decompress zlib-compressed transmissions (o=z).Change to existing code
ResizeTraditionalpreviously freed rows without destroying them, so image data leaked on resize. This affected sixel images too, so the fix changes existing behaviour.How it works
- The cell footprint and cursor movement use the same virtual cell size as sixel, so ConPTY and the terminal agree on the cursor position.
- After a placement, conhost marks its cursor position as uncertain, so it rechecks against the real terminal.
- Conhost only reads the image size rather than decoding it, so images aren't decoded twice.
- AtlasEngine with Direct3D draws images in three layers by z-index: under cell backgrounds, under text, and above text.
- AtlasEngine with Direct2D draws two layers. Images under coloured cell backgrounds are drawn under the text but over the background.
- AtlasEngine downscales images larger than the GPU's maximum bitmap size.
- GDI draws images under or over the text according to their z-index.
Validation Steps Performed
PR Checklist
Written with AI assistance.