diff --git a/box.go b/box.go index 166c6b8..654d907 100644 --- a/box.go +++ b/box.go @@ -236,19 +236,19 @@ func (b *Box) Draw(screen tcell.Screen) { border := background.Foreground(b.borderColor) var vertical, horizontal, topLeft, topRight, bottomLeft, bottomRight rune if b.focus.HasFocus() { - vertical = GraphicsDbVertBar - horizontal = GraphicsDbHorBar - topLeft = GraphicsDbTopLeftCorner - topRight = GraphicsDbTopRightCorner - bottomLeft = GraphicsDbBottomLeftCorner - bottomRight = GraphicsDbBottomRightCorner + horizontal = Borders.HorizontalFocus + vertical = Borders.VerticalFocus + topLeft = Borders.TopLeftFocus + topRight = Borders.TopRightFocus + bottomLeft = Borders.BottomLeftFocus + bottomRight = Borders.BottomRightFocus } else { - vertical = GraphicsVertBar - horizontal = GraphicsHoriBar - topLeft = GraphicsTopLeftCorner - topRight = GraphicsTopRightCorner - bottomLeft = GraphicsBottomLeftCorner - bottomRight = GraphicsBottomRightCorner + horizontal = Borders.Horizontal + vertical = Borders.Vertical + topLeft = Borders.TopLeft + topRight = Borders.TopRight + bottomLeft = Borders.BottomLeft + bottomRight = Borders.BottomRight } for x := b.x + 1; x < b.x+b.width-1; x++ { screen.SetContent(x, b.y, horizontal, nil, border) @@ -269,7 +269,7 @@ func (b *Box) Draw(screen tcell.Screen) { if StringWidth(b.title)-printed > 0 && printed > 0 { _, _, style, _ := screen.GetContent(b.x+b.width-2, b.y) fg, _, _ := style.Decompose() - Print(screen, string(GraphicsEllipsis), b.x+b.width-2, b.y, 1, AlignLeft, fg) + Print(screen, string(SemigraphicsHorizontalEllipsis), b.x+b.width-2, b.y, 1, AlignLeft, fg) } } } diff --git a/demos/presentation/table.go b/demos/presentation/table.go index 435e2d1..798c11c 100644 --- a/demos/presentation/table.go +++ b/demos/presentation/table.go @@ -87,7 +87,7 @@ const tableBasic = `[green]func[white] [yellow]main[white]() { const tableSeparator = `[green]func[white] [yellow]main[white]() { table := tview.[yellow]NewTable[white](). [yellow]SetFixed[white]([red]1[white], [red]1[white]). - [yellow]SetSeparator[white](tview.GraphicsVertBar) + [yellow]SetSeparator[white](Borders.Vertical) [yellow]for[white] row := [red]0[white]; row < [red]40[white]; row++ { [yellow]for[white] column := [red]0[white]; column < [red]7[white]; column++ { color := tcell.ColorWhite @@ -295,7 +295,7 @@ func Table(nextSlide func()) (title string, content tview.Primitive) { separator := func() { table.SetBorders(false). SetSelectable(false, false). - SetSeparator(tview.GraphicsVertBar) + SetSeparator(tview.Borders.Vertical) code.Clear() fmt.Fprint(code, tableSeparator) } diff --git a/grid.go b/grid.go index f7d61a5..c69148b 100644 --- a/grid.go +++ b/grid.go @@ -590,11 +590,11 @@ func (g *Grid) Draw(screen tcell.Screen) { } by := item.y - 1 if by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsHoriBar, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.Horizontal, g.bordersColor) } by = item.y + item.h if by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsHoriBar, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.Horizontal, g.bordersColor) } } for by := item.y; by < item.y+item.h; by++ { // Left/right lines. @@ -603,28 +603,28 @@ func (g *Grid) Draw(screen tcell.Screen) { } bx := item.x - 1 if bx >= 0 && bx < width { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsVertBar, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.Vertical, g.bordersColor) } bx = item.x + item.w if bx >= 0 && bx < width { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsVertBar, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.Vertical, g.bordersColor) } } bx, by := item.x-1, item.y-1 // Top-left corner. if bx >= 0 && bx < width && by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsTopLeftCorner, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.TopLeft, g.bordersColor) } bx, by = item.x+item.w, item.y-1 // Top-right corner. if bx >= 0 && bx < width && by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsTopRightCorner, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.TopRight, g.bordersColor) } bx, by = item.x-1, item.y+item.h // Bottom-left corner. if bx >= 0 && bx < width && by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsBottomLeftCorner, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.BottomLeft, g.bordersColor) } bx, by = item.x+item.w, item.y+item.h // Bottom-right corner. if bx >= 0 && bx < width && by >= 0 && by < height { - PrintJoinedBorder(screen, x+bx, y+by, GraphicsBottomRightCorner, g.bordersColor) + PrintJoinedBorder(screen, x+bx, y+by, Borders.BottomRight, g.bordersColor) } } } diff --git a/table.go b/table.go index 4036013..10f8399 100644 --- a/table.go +++ b/table.go @@ -278,7 +278,7 @@ func (t *Table) SetBordersColor(color tcell.Color) *Table { // SetSeparator sets the character used to fill the space between two // neighboring cells. This is a space character ' ' per default but you may -// want to set it to GraphicsVertBar (or any other rune) if the column +// want to set it to Borders.Vertical (or any other rune) if the column // separation should be more visible. If cell borders are activated, this is // ignored. // @@ -668,24 +668,24 @@ ColumnLoop: // Draw borders. rowY *= 2 for pos := 0; pos < columnWidth && columnX+1+pos < width; pos++ { - drawBorder(columnX+pos+1, rowY, GraphicsHoriBar) + drawBorder(columnX+pos+1, rowY, Borders.Horizontal) } - ch := GraphicsCross + ch := Borders.Cross if columnIndex == 0 { if rowY == 0 { - ch = GraphicsTopLeftCorner + ch = Borders.TopLeft } else { - ch = GraphicsLeftT + ch = Borders.LeftT } } else if rowY == 0 { - ch = GraphicsTopT + ch = Borders.TopT } drawBorder(columnX, rowY, ch) rowY++ if rowY >= height { break // No space for the text anymore. } - drawBorder(columnX, rowY, GraphicsVertBar) + drawBorder(columnX, rowY, Borders.Vertical) } else if columnIndex > 0 { // Draw separator. drawBorder(columnX, rowY, t.separator) @@ -706,18 +706,18 @@ ColumnLoop: _, 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) - printWithStyle(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style) + printWithStyle(screen, string(SemigraphicsHorizontalEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style) } } // Draw bottom border. if rowY := 2 * len(rows); t.borders && rowY < height { for pos := 0; pos < columnWidth && columnX+1+pos < width; pos++ { - drawBorder(columnX+pos+1, rowY, GraphicsHoriBar) + drawBorder(columnX+pos+1, rowY, Borders.Horizontal) } - ch := GraphicsBottomT + ch := Borders.BottomT if columnIndex == 0 { - ch = GraphicsBottomLeftCorner + ch = Borders.BottomLeft } drawBorder(columnX, rowY, ch) } @@ -730,16 +730,16 @@ ColumnLoop: for rowY := range rows { rowY *= 2 if rowY+1 < height { - drawBorder(columnX, rowY+1, GraphicsVertBar) + drawBorder(columnX, rowY+1, Borders.Vertical) } - ch := GraphicsRightT + ch := Borders.RightT if rowY == 0 { - ch = GraphicsTopRightCorner + ch = Borders.TopRight } drawBorder(columnX, rowY, ch) } if rowY := 2 * len(rows); rowY < height { - drawBorder(columnX, rowY, GraphicsBottomRightCorner) + drawBorder(columnX, rowY, Borders.BottomRight) } }