mirror of https://github.com/mum4k/termdash.git
fix font modifiers test coverage and style nitpicks
This commit is contained in:
parent
4946857fbd
commit
93ddcf4615
|
@ -80,12 +80,16 @@ func TestNewOptions(t *testing.T) {
|
|||
Italic(),
|
||||
Underline(),
|
||||
Strikethrough(),
|
||||
Inverse(),
|
||||
Blink(),
|
||||
},
|
||||
want: &Options{
|
||||
Bold: true,
|
||||
Italic: true,
|
||||
Underline: true,
|
||||
Strikethrough: true,
|
||||
Inverse: true,
|
||||
Blink: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -63,6 +63,13 @@ func cellOptsToStyle(opts *cell.Options, colorMode terminalapi.ColorMode) tcell.
|
|||
fg := cellColor(colorToMode(opts.FgColor, colorMode))
|
||||
bg := cellColor(colorToMode(opts.BgColor, colorMode))
|
||||
|
||||
st = st.Foreground(fg).Background(bg).Bold(opts.Bold).Italic(opts.Italic).Underline(opts.Underline).StrikeThrough(opts.Strikethrough).Reverse(opts.Inverse).Blink(opts.Blink)
|
||||
st = st.Foreground(fg).
|
||||
Background(bg).
|
||||
Bold(opts.Bold).
|
||||
Italic(opts.Italic).
|
||||
Underline(opts.Underline).
|
||||
StrikeThrough(opts.Strikethrough).
|
||||
Reverse(opts.Inverse).
|
||||
Blink(opts.Blink)
|
||||
return st
|
||||
}
|
||||
|
|
|
@ -49,21 +49,21 @@ func cellOptsToFg(opts *cell.Options) (tbx.Attribute, error) {
|
|||
if opts.Bold {
|
||||
a |= tbx.AttrBold
|
||||
}
|
||||
// FIXME: Termbox doesn't have an italics attribute
|
||||
// Termbox doesn't have an italics attribute
|
||||
if opts.Italic {
|
||||
return 0, errors.New("Termbox: Unsupported attribute: Italic")
|
||||
}
|
||||
if opts.Underline {
|
||||
a |= tbx.AttrUnderline
|
||||
}
|
||||
// FIXME: Termbox doesn't have a strikethrough attribute
|
||||
// Termbox doesn't have a strikethrough attribute
|
||||
if opts.Strikethrough {
|
||||
return 0, errors.New("Termbox: Unsupported attribute: Strikethrough")
|
||||
}
|
||||
if opts.Inverse {
|
||||
a |= tbx.AttrReverse
|
||||
}
|
||||
// FIXME: Termbox doesn't have a blink attribute
|
||||
// Termbox doesn't have a blink attribute
|
||||
if opts.Blink {
|
||||
return 0, errors.New("Termbox: Unsupported attribute: Blink")
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ func TestCellFontModifier(t *testing.T) {
|
|||
{cell.Options{Underline: true}, tbx.AttrUnderline, false},
|
||||
{cell.Options{Italic: true}, 0, true},
|
||||
{cell.Options{Strikethrough: true}, 0, true},
|
||||
{cell.Options{Inverse: true}, tbx.AttrReverse, true},
|
||||
{cell.Options{Inverse: true}, tbx.AttrReverse, false},
|
||||
{cell.Options{Blink: true}, 0, true},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue