From bedb9979a9b65dad9d72dcbdb3174508d3714f36 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 23 May 2018 00:44:08 +0300 Subject: Update some dependencies --- vendor/maunium.net/go/tview/table.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'vendor/maunium.net/go/tview/table.go') diff --git a/vendor/maunium.net/go/tview/table.go b/vendor/maunium.net/go/tview/table.go index 0446c6a..2491ec7 100644 --- a/vendor/maunium.net/go/tview/table.go +++ b/vendor/maunium.net/go/tview/table.go @@ -33,6 +33,9 @@ type TableCell struct { // The background color of the cell. BackgroundColor tcell.Color + // The style attributes of the cell. + Attributes tcell.AttrMask + // If set to true, this cell cannot be selected. NotSelectable bool @@ -107,6 +110,22 @@ func (c *TableCell) SetBackgroundColor(color tcell.Color) *TableCell { return c } +// SetAttributes sets the cell's text attributes. You can combine different +// attributes using bitmask operations: +// +// cell.SetAttributes(tcell.AttrUnderline | tcell.AttrBold) +func (c *TableCell) SetAttributes(attr tcell.AttrMask) *TableCell { + c.Attributes = attr + return c +} + +// SetStyle sets the cell's style (foreground color, background color, and +// attributes) all at once. +func (c *TableCell) SetStyle(style tcell.Style) *TableCell { + c.Color, c.BackgroundColor, c.Attributes = style.Decompose() + return c +} + // SetSelectable sets whether or not this cell can be selected by the user. func (c *TableCell) SetSelectable(selectable bool) *TableCell { c.NotSelectable = !selectable @@ -684,11 +703,10 @@ ColumnLoop: finalWidth = width - columnX - 1 } cell.x, cell.y, cell.width = x+columnX+1, y+rowY, finalWidth - _, printed := Print(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, cell.Color) + _, printed := printWithStyle(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, tcell.StyleDefault.Foreground(cell.Color)|tcell.Style(cell.Attributes)) if StringWidth(cell.Text)-printed > 0 && printed > 0 { _, _, style, _ := screen.GetContent(x+columnX+1+finalWidth-1, y+rowY) - fg, _, _ := style.Decompose() - Print(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, fg) + printWithStyle(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style) } } -- cgit v1.2.3