Skip to content

Commit

Permalink
ChafaTermDb: Eat understands sixel graphics
Browse files Browse the repository at this point in the history
The Eat terminal supports Sixel mode as of version 0.9:
https://www.reddit.com/r/emacs/comments/172vgex/eat_09_released/

The proper way to detect Eat is to look for the
EAT_SHELL_INTEGRATION_DIR environment variable. It also sets TERM with
the "eat-" prefix, i.e. "eat-truecolor".

Closes #197.
  • Loading branch information
sfllaw authored and hpjansson committed Apr 19, 2024
1 parent c12ef2c commit 6be4dfa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chafa/chafa-term-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
const gchar *mlterm;
const gchar *nvim;
const gchar *nvim_tui_enable_true_color;
const gchar *eat_shell_integration_dir;
gchar *comspec = NULL;
const SeqStr **color_seq_list = color_256_list;
const SeqStr *gfx_seqs = NULL;
Expand All @@ -411,6 +412,7 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
mlterm = getenv_or_blank (envp, "MLTERM");
nvim = getenv_or_blank (envp, "NVIM");
nvim_tui_enable_true_color = getenv_or_blank (envp, "NVIM_TUI_ENABLE_TRUE_COLOR");
eat_shell_integration_dir = getenv_or_blank (envp, "EAT_SHELL_INTEGRATION_DIR");

/* The MS Windows 10 TH2 (v1511+) console supports ANSI escape codes,
* including AIX and DirectColor sequences. We detect this early and allow
Expand Down Expand Up @@ -544,6 +546,11 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
if (!strcmp (term, "rxvt-unicode"))
color_seq_list = color_16_list;

/* Eat uses the "eat-" prefix for TERM.
* Eat also sets EAT_SHELL_INTEGRATION_DIR in the environment. */
if (!strncmp (term, "eat-", 4) || strcmp (eat_shell_integration_dir, ""))
gfx_seqs = sixel_seqs;

/* 'screen' does not like truecolor at all, but 256 colors works fine.
* Sometimes we'll see the outer terminal appended to the TERM string,
* like so: screen.xterm-256color */
Expand Down

0 comments on commit 6be4dfa

Please sign in to comment.