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
bottomRight = GraphicsDbBottomRightCorner
} else {
vertical = GraphicsHoriBar
horizontal = GraphicsVertBar
vertical = GraphicsVertBar
horizontal = GraphicsHoriBar
topLeft = GraphicsTopLeftCorner
topRight = GraphicsTopRightCorner
bottomLeft = GraphicsBottomLeftCorner
bottomRight = GraphicsBottomRightCorner
}
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+b.height-1, vertical, nil, border)
screen.SetContent(x, b.y, horizontal, 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++ {
screen.SetContent(b.x, y, horizontal, nil, border)
screen.SetContent(b.x+b.width-1, y, horizontal, nil, border)
screen.SetContent(b.x, y, vertical, 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.width-1, b.y, topRight, nil, border)

36
util.go
View File

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