summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2020-10-18 16:46:40 +0200
committerHubert Hirtz <hubert@hirtz.pm>2020-10-18 16:46:40 +0200
commit7b7b063b79c3590f341fedc96abe49fe333b3800 (patch)
tree3c199170a5e37c6dc3d047504004322558ceae9e
parentUpdate tcell to v2 and (diff)
Display strike-through text
Diffstat (limited to '')
-rw-r--r--ui/style.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/ui/style.go b/ui/style.go
index 2e09506..77dc515 100644
--- a/ui/style.go
+++ b/ui/style.go
@@ -46,12 +46,13 @@ func StringWidth(s string) int {
}
type StyleBuffer struct {
- st tcell.Style
- color colorBuffer
- bold bool
- reverse bool
- italic bool
- underline bool
+ st tcell.Style
+ color colorBuffer
+ bold bool
+ reverse bool
+ italic bool
+ strikethrough bool
+ underline bool
}
func (sb *StyleBuffer) Reset() {
@@ -60,6 +61,7 @@ func (sb *StyleBuffer) Reset() {
sb.bold = false
sb.reverse = false
sb.italic = false
+ sb.strikethrough = false
sb.underline = false
}
@@ -83,6 +85,11 @@ func (sb *StyleBuffer) WriteRune(r rune) (st tcell.Style, ok int) {
sb.st = st.Italic(sb.italic)
return sb.st, 0
}
+ if r == 0x1E {
+ sb.strikethrough = !sb.strikethrough
+ sb.st = st.StrikeThrough(sb.strikethrough)
+ return sb.st, 0
+ }
if r == 0x1F {
sb.underline = !sb.underline
sb.st = st.Underline(sb.underline)