| skipped 7 lines |
8 | 8 | | |
9 | 9 | | "runtime" |
10 | 10 | | |
11 | | - | "github.com/gdamore/tcell" |
12 | | - | "github.com/gdamore/tcell/encoding" |
| 11 | + | "github.com/gdamore/tcell/v2" |
| 12 | + | "github.com/gdamore/tcell/v2/encoding" |
13 | 13 | | |
14 | 14 | | "github.com/mattn/go-runewidth" |
15 | 15 | | "github.com/rivo/uniseg" |
| skipped 3 lines |
19 | 19 | | return true |
20 | 20 | | } |
21 | 21 | | |
| 22 | + | func asTcellColor(color Color) tcell.Color { |
| 23 | + | value := uint64(tcell.ColorValid) + uint64(color) |
| 24 | + | if color.is24() { |
| 25 | + | value = value | uint64(tcell.ColorIsRGB) |
| 26 | + | } |
| 27 | + | return tcell.Color(value) |
| 28 | + | } |
| 29 | + | |
22 | 30 | | func (p ColorPair) style() tcell.Style { |
23 | 31 | | style := tcell.StyleDefault |
24 | | - | return style.Foreground(tcell.Color(p.Fg())).Background(tcell.Color(p.Bg())) |
| 32 | + | return style.Foreground(asTcellColor(p.Fg())).Background(asTcellColor(p.Bg())) |
25 | 33 | | } |
26 | 34 | | |
27 | | - | type Attr tcell.Style |
| 35 | + | type Attr int32 |
28 | 36 | | |
29 | 37 | | type TcellWindow struct { |
30 | 38 | | color bool |
| skipped 41 lines |
72 | 80 | | } |
73 | 81 | | |
74 | 82 | | const ( |
75 | | - | Bold Attr = Attr(tcell.AttrBold) |
76 | | - | Dim = Attr(tcell.AttrDim) |
77 | | - | Blink = Attr(tcell.AttrBlink) |
78 | | - | Reverse = Attr(tcell.AttrReverse) |
79 | | - | Underline = Attr(tcell.AttrUnderline) |
80 | | - | Italic = Attr(tcell.AttrItalic) |
| 83 | + | Bold Attr = Attr(tcell.AttrBold) |
| 84 | + | Dim = Attr(tcell.AttrDim) |
| 85 | + | Blink = Attr(tcell.AttrBlink) |
| 86 | + | Reverse = Attr(tcell.AttrReverse) |
| 87 | + | Underline = Attr(tcell.AttrUnderline) |
| 88 | + | StrikeThrough = Attr(tcell.AttrStrikeThrough) |
| 89 | + | Italic = Attr(tcell.AttrItalic) |
81 | 90 | | ) |
82 | 91 | | |
83 | 92 | | const ( |
| skipped 477 lines |
561 | 570 | | style = style. |
562 | 571 | | Reverse(a&Attr(tcell.AttrReverse) != 0). |
563 | 572 | | Underline(a&Attr(tcell.AttrUnderline) != 0). |
| 573 | + | StrikeThrough(a&Attr(tcell.AttrStrikeThrough) != 0). |
564 | 574 | | Italic(a&Attr(tcell.AttrItalic) != 0). |
565 | 575 | | Blink(a&Attr(tcell.AttrBlink) != 0). |
566 | 576 | | Dim(a&Attr(tcell.AttrDim) != 0) |
| skipped 45 lines |
612 | 622 | | Dim(a&Attr(tcell.AttrDim) != 0). |
613 | 623 | | Reverse(a&Attr(tcell.AttrReverse) != 0). |
614 | 624 | | Underline(a&Attr(tcell.AttrUnderline) != 0). |
| 625 | + | StrikeThrough(a&Attr(tcell.AttrStrikeThrough) != 0). |
615 | 626 | | Italic(a&Attr(tcell.AttrItalic) != 0) |
616 | 627 | | |
617 | 628 | | gr := uniseg.NewGraphemes(text) |
| skipped 105 lines |