From 7b7b063b79c3590f341fedc96abe49fe333b3800 Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Sun, 18 Oct 2020 16:46:40 +0200 Subject: Display strike-through text --- ui/style.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ui') 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) -- cgit v1.2.3