forked from tslocum/cview
Update strikethrough implementation
This commit is contained in:
parent
624a3fae3c
commit
2ebdbde722
2
doc.go
2
doc.go
|
@ -129,7 +129,7 @@ terminal):
|
|||
i: italic
|
||||
r: reverse (switch foreground and background color)
|
||||
u: underline
|
||||
s: strikeout
|
||||
s: strikethrough
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
4
go.mod
4
go.mod
|
@ -3,10 +3,10 @@ module gitlab.com/tslocum/cview
|
|||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831064001-c008cc6a3b61
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831155531-da485f47343b
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3
|
||||
github.com/mattn/go-runewidth v0.0.9
|
||||
github.com/rivo/uniseg v0.1.0
|
||||
gitlab.com/tslocum/cbind v0.1.2-0.20200826214515-b5f2c6a8711a
|
||||
golang.org/x/sys v0.0.0-20200828194041-157a740278f4 // indirect
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a // indirect
|
||||
)
|
||||
|
|
8
go.sum
8
go.sum
|
@ -1,8 +1,8 @@
|
|||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831064001-c008cc6a3b61 h1:61w16Im1XBJcfqvNoOgSjMaoBL50nRy2aqJ4LNWsXXY=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831064001-c008cc6a3b61/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831155531-da485f47343b h1:j9fvrLkgzxR1S/ZWI6fbw8hjNxU5/lxnVXBX2tuYGVA=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831155531-da485f47343b/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
|
@ -15,8 +15,8 @@ gitlab.com/tslocum/cbind v0.1.2-0.20200826214515-b5f2c6a8711a/go.mod h1:HfB7qAhH
|
|||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 h1:DvY3Zkh7KabQE/kfzMvYvKirSiguP9Q/veMtkYyf0o8=
|
||||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200828194041-157a740278f4 h1:kCCpuwSAoYJPkNc6x0xT9yTtV4oKtARo4RGBQWOfg9E=
|
||||
golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a h1:i47hUS795cOydZI4AwJQCKXOr4BvxzvikwDoDtHhP2Y=
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
|
4
util.go
4
util.go
|
@ -159,7 +159,7 @@ func overlayStyle(background tcell.Color, defaultStyle tcell.Style, fgColor, bgC
|
|||
style = style.Italic(defAttr&tcell.AttrItalic > 0)
|
||||
style = style.Reverse(defAttr&tcell.AttrReverse > 0)
|
||||
style = style.Underline(defAttr&tcell.AttrUnderline > 0)
|
||||
style = style.StrikeOut(defAttr&tcell.AttrStrikeOut > 0)
|
||||
style = style.StrikeThrough(defAttr&tcell.AttrStrikeThrough > 0)
|
||||
} else if attributes != "" {
|
||||
style = style.Normal()
|
||||
for _, flag := range attributes {
|
||||
|
@ -177,7 +177,7 @@ func overlayStyle(background tcell.Color, defaultStyle tcell.Style, fgColor, bgC
|
|||
case 'u':
|
||||
style = style.Underline(true)
|
||||
case 's':
|
||||
style = style.StrikeOut(true)
|
||||
style = style.StrikeThrough(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue