commit 7b7b063
Hubert Hirtz
·
2020-10-18 14:46:40 +0000 UTC
parent c9dc688
Display strike-through text
1 files changed,
+13,
-6
+13,
-6
1@@ -46,12 +46,13 @@ func StringWidth(s string) int {
2 }
3
4 type StyleBuffer struct {
5- st tcell.Style
6- color colorBuffer
7- bold bool
8- reverse bool
9- italic bool
10- underline bool
11+ st tcell.Style
12+ color colorBuffer
13+ bold bool
14+ reverse bool
15+ italic bool
16+ strikethrough bool
17+ underline bool
18 }
19
20 func (sb *StyleBuffer) Reset() {
21@@ -60,6 +61,7 @@ func (sb *StyleBuffer) Reset() {
22 sb.bold = false
23 sb.reverse = false
24 sb.italic = false
25+ sb.strikethrough = false
26 sb.underline = false
27 }
28
29@@ -83,6 +85,11 @@ func (sb *StyleBuffer) WriteRune(r rune) (st tcell.Style, ok int) {
30 sb.st = st.Italic(sb.italic)
31 return sb.st, 0
32 }
33+ if r == 0x1E {
34+ sb.strikethrough = !sb.strikethrough
35+ sb.st = st.StrikeThrough(sb.strikethrough)
36+ return sb.st, 0
37+ }
38 if r == 0x1F {
39 sb.underline = !sb.underline
40 sb.st = st.Underline(sb.underline)