Browse Source

Expose strikethrough support

Resolves #17.
tablepad
Trevor Slocum 2 years ago
parent
commit
a6258efb39
  1. 2
      CHANGELOG
  2. 1
      doc.go
  3. 2
      go.mod
  4. 4
      go.sum
  5. 3
      util.go

2
CHANGELOG

@ -1,6 +1,6 @@
v1.4.9 (WIP)
- Add InputField.GetCursorPosition and InputField.SetCursorPosition
- Upgrade tcell to v2
- Upgrade tcell to v2: includes strikethrough support
v1.4.8 (2020-08-11)
- Add italic text formatting flag

1
doc.go

@ -129,6 +129,7 @@ terminal):
i: italic
r: reverse (switch foreground and background color)
u: underline
s: strikeout
Examples:

2
go.mod

@ -3,7 +3,7 @@ module gitlab.com/tslocum/cview
go 1.12
require (
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200830100347-23606a43e286
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200831064001-c008cc6a3b61
github.com/lucasb-eyer/go-colorful v1.0.3
github.com/mattn/go-runewidth v0.0.9
github.com/rivo/uniseg v0.1.0

4
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.20200830100347-23606a43e286 h1:29adRtDgT5AaOR9RiDQaZeiY+lb8mbQwz9WklTK6EuQ=
github.com/gdamore/tcell/v2 v2.0.0-dev.0.20200830100347-23606a43e286/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/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=

3
util.go

@ -159,6 +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)
} else if attributes != "" {
style = style.Normal()
for _, flag := range attributes {
@ -175,6 +176,8 @@ func overlayStyle(background tcell.Color, defaultStyle tcell.Style, fgColor, bgC
style = style.Reverse(true)
case 'u':
style = style.Underline(true)
case 's':
style = style.StrikeOut(true)
}
}
}

Loading…
Cancel
Save