Real-image posters: draw placeholder cells on the panes' background color

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 23:17:40 +02:00
co-authored by Claude Sonnet 5.5
parent dd6f862d61
commit 0ccd02b3c5
3 changed files with 10 additions and 3 deletions
+4 -1
View File
@@ -9,6 +9,7 @@ import (
"strings"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
// The Kitty graphics protocol with Unicode placeholders, as supported by
@@ -139,7 +140,9 @@ func (k *kittyGraphics) deleteAll() {
func placeholderCell(id uint32, row, col int) (main rune, comb []rune, style tcell.Style) {
comb = []rune{kittyDiacritics[row], kittyDiacritics[col]}
fg := tcell.NewRGBColor(int32(id>>16&0xFF), int32(id>>8&0xFF), int32(id&0xFF))
return placeholderRune, comb, tcell.StyleDefault.Foreground(fg)
// The background shows wherever the picture does not cover the cell (a
// sliver at the edge): use the panes' own color so it is not visible.
return placeholderRune, comb, tcell.StyleDefault.Foreground(fg).Background(tview.Styles.PrimitiveBackgroundColor)
}
// maxPlaceholders is how many rows and columns can be numbered.