dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
23.12k stars 382 forks source link

šŸ› Pass through data in iTerm image protocol #1399

Open adamchainz opened 1 year ago

adamchainz commented 1 year ago

iTermā€™s inline image protocol is a de facto standard for displaying images in the terminal. It has been copied by at least wezterm.

This blog post covers setting up Git to use the protocol to show images within diffs. But after following it, I found delta erases the image escape codes:

Xnapper-2023-04-19-17 57 24

This is what the setup looks like with vanilla less:

Xnapper-2023-04-19-17 56 45

I guess this is part of how delta strips formatting from incoming diffs, in order to apply its own? If so it might be possible to special case the 1337 escape code for all iTerm ANSI extensions.

(I'm not that interested in this feature myself, since the image diffing seems a bit limited. But I thought delta shouldn't accidentally block this use case.)

dandavison commented 1 year ago

Interesting. If you use core.pager='cat -A' or bat -A or hexdump or hexyl or something, can you confirm that git is definitely passing the escape codes on to the pager?

adamchainz commented 1 year ago

Yes it is:

Xnapper-2023-04-20-08 06 15

(Sorry, I meant to use less for the second screenshot above.)