1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-28 13:48:53 +08:00

fix borders and add unicode comment

This commit is contained in:
Benjamin Weidig 2018-05-26 16:02:21 +02:00
parent 0ebcb1ed99
commit 76fdcb42e9
2 changed files with 24 additions and 24 deletions

12
box.go
View File

@ -243,20 +243,20 @@ func (b *Box) Draw(screen tcell.Screen) {
bottomLeft = GraphicsDbBottomLeftCorner bottomLeft = GraphicsDbBottomLeftCorner
bottomRight = GraphicsDbBottomRightCorner bottomRight = GraphicsDbBottomRightCorner
} else { } else {
vertical = GraphicsHoriBar vertical = GraphicsVertBar
horizontal = GraphicsVertBar horizontal = GraphicsHoriBar
topLeft = GraphicsTopLeftCorner topLeft = GraphicsTopLeftCorner
topRight = GraphicsTopRightCorner topRight = GraphicsTopRightCorner
bottomLeft = GraphicsBottomLeftCorner bottomLeft = GraphicsBottomLeftCorner
bottomRight = GraphicsBottomRightCorner bottomRight = GraphicsBottomRightCorner
} }
for x := b.x + 1; x < b.x+b.width-1; x++ { for x := b.x + 1; x < b.x+b.width-1; x++ {
screen.SetContent(x, b.y, vertical, nil, border) screen.SetContent(x, b.y, horizontal, nil, border)
screen.SetContent(x, b.y+b.height-1, vertical, nil, border) screen.SetContent(x, b.y+b.height-1, horizontal, nil, border)
} }
for y := b.y + 1; y < b.y+b.height-1; y++ { for y := b.y + 1; y < b.y+b.height-1; y++ {
screen.SetContent(b.x, y, horizontal, nil, border) screen.SetContent(b.x, y, vertical, nil, border)
screen.SetContent(b.x+b.width-1, y, horizontal, nil, border) screen.SetContent(b.x+b.width-1, y, vertical, nil, border)
} }
screen.SetContent(b.x, b.y, topLeft, nil, border) screen.SetContent(b.x, b.y, topLeft, nil, border)
screen.SetContent(b.x+b.width-1, b.y, topRight, nil, border) screen.SetContent(b.x+b.width-1, b.y, topRight, nil, border)

36
util.go
View File

@ -21,24 +21,24 @@ const (
// Semigraphical runes. // Semigraphical runes.
const ( const (
GraphicsHoriBar = '\u2500' GraphicsHoriBar = '\u2500' // ─
GraphicsVertBar = '\u2502' GraphicsVertBar = '\u2502' // │
GraphicsTopLeftCorner = '\u250c' GraphicsTopLeftCorner = '\u250c' // ┌
GraphicsTopRightCorner = '\u2510' GraphicsTopRightCorner = '\u2510' // ┐
GraphicsBottomLeftCorner = '\u2514' GraphicsBottomLeftCorner = '\u2514' // └
GraphicsBottomRightCorner = '\u2518' GraphicsBottomRightCorner = '\u2518' // ┘
GraphicsLeftT = '\u251c' GraphicsLeftT = '\u251c' // ├
GraphicsRightT = '\u2524' GraphicsRightT = '\u2524' // ┤
GraphicsTopT = '\u252c' GraphicsTopT = '\u252c' // ┬
GraphicsBottomT = '\u2534' GraphicsBottomT = '\u2534' // ┴
GraphicsCross = '\u253c' GraphicsCross = '\u253c' // ┼
GraphicsDbVertBar = '\u2550' GraphicsDbHorBar = '\u2550' // ═
GraphicsDbHorBar = '\u2551' GraphicsDbVertBar = '\u2551' // ║
GraphicsDbTopLeftCorner = '\u2554' GraphicsDbTopLeftCorner = '\u2554' // ╔
GraphicsDbTopRightCorner = '\u2557' GraphicsDbTopRightCorner = '\u2557' // ╗
GraphicsDbBottomRightCorner = '\u255d' GraphicsDbBottomRightCorner = '\u255d' // ╝
GraphicsDbBottomLeftCorner = '\u255a' GraphicsDbBottomLeftCorner = '\u255a' // ╚
GraphicsEllipsis = '\u2026' GraphicsEllipsis = '\u2026' // …
) )
// joints maps combinations of two graphical runes to the rune that results // joints maps combinations of two graphical runes to the rune that results