feat(messageslist): draw kitty images in Rio (#851)

This commit is contained in:
ayn2op 2026-10-19 00:55:37 -04:00 • committed by GitHub
parent cb4c82d3e1
commit eb4028957d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,10 @@ import (
"github.com/yuin/goldmark/v2/ast" "github.com/yuin/goldmark/v2/ast"
) )
// placeholderTerminals are the terminals, by XTVERSION name, that draw kitty's Unicode placeholders.
// WezTerm and Konsole support kitty graphics but not Unicode placeholders.
var placeholderTerminals = []string{"kitty", "ghostty", "Rio"}
type messageItem struct { type messageItem struct {
message discord.Message message discord.Message
// view is the message as drawn, keeping its wrapped text, or nil until it is shown and after what it shows changes. // view is the message as drawn, keeping its wrapped text, or nil until it is shown and after what it shows changes.
@ -557,8 +561,7 @@ func (m Model) Update(msg tview.Msg) (Model, tview.Cmd) {
case "halfblocks": case "halfblocks":
m.kitty = false m.kitty = false
default: default:
// WezTerm and Konsole support kitty graphics but not Unicode placeholders. m.kitty = slices.Contains(placeholderTerminals, msg.Name)
m.kitty = msg.Name == "kitty" || msg.Name == "ghostty"
} }
case scrollMsg: case scrollMsg:
m.scrollState = viewport.ScrollState(msg) m.scrollState = viewport.ScrollState(msg)