chafa icon indicating copy to clipboard operation
chafa copied to clipboard

Refactor ChafaTermDb

Open hpjansson opened this issue 1 year ago • 0 comments

I gave ChafaTermDb a minimal API initially, since I wanted to gather more information about typical situations/available terminals and then refactor at a later time based on that.

That time is now extremely nigh.

Existing methods can stay the same, but internally it would be nice to get rid of the big heuristics hairball and instead relegate each terminal to a table of pointers to groups of seqs. E.g. vt100 + 256-color SGRs + sixels for mlterm. Terminal capabilities could then be merged successively using the existing merge API (e.g. if running in tmux, we could merge tmux on top of mlterm).

This must be done very carefully in order to avoid regressions.

Terminals (or perhaps "situations") could then be given names, which could be exposed to callers. This could then be used as a sequence library for the query-based detection functionality.

Names will also allow API users to identify which overall terminal/situation was actually detected, and not just the individual sequences.

hpjansson avatar Sep 04 '23 00:09 hpjansson