gitstack

grindlemire/go-tui code browser

399 B Go 18 lines 2026-06-23 · 2a4aa99 raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package tui

import "unicode/utf8"

// cellGlyph reconstructs the full glyph of a cell (base rune + combining string).
// Returns the empty string for empty/continuation cells (Rune == 0).
func cellGlyph(c Cell) string {
	if c.Rune == 0 {
		return ""
	}
	var buf [utf8.UTFMax]byte
	n := utf8.EncodeRune(buf[:], c.Rune)
	s := string(buf[:n])
	if c.Combining != "" {
		s += c.Combining
	}
	return s
}