better horizontal scroll draw support

This commit is contained in:
Vladimir Markelov 2015-11-06 11:55:57 -08:00
parent 9fb3d3174e
commit 54bead63d9
6 changed files with 12 additions and 8 deletions

View File

@ -286,15 +286,19 @@ func (fb *FrameBuffer) DrawScroll(x, y, w, h, pos int, fgScroll, bgScroll, fgThu
}
if scrollChars == "" {
scrollChars = "░■▲▼"
scrollChars = "░■▲▼◄►"
}
parts := []rune(scrollChars)
chLine, chCursor, chUp, chDown := parts[0], parts[1], parts[2], parts[3]
chLeft, chRight := '◄', '►'
if len(parts) > 4 {
chLeft, chRight = parts[4], parts[5]
}
if h == 1 {
fb.PutChar(x, y, chUp, fgScroll, bgScroll)
fb.PutChar(x+w-1, y, chDown, fgScroll, bgScroll)
fb.PutChar(x, y, chLeft, fgScroll, bgScroll)
fb.PutChar(x+w-1, y, chRight, fgScroll, bgScroll)
if w > 2 {
for xx := 1; xx < w-1; xx++ {

View File

@ -16,7 +16,7 @@ ProgressActiveText = white
SingleBorder=-|++++
DoubleBorder==|++++
Edit=<>V
ScrollBar=|O^V
ScrollBar=|O^V<>
ViewButtons=^_X[]
CheckBox=[] X?
Radio=() *

View File

@ -58,7 +58,7 @@ ButtonDisabledBack=white
SingleBorder=─│┌┐└┘
DoubleBorder=═║╔╗╚╝
Edit=←→V
ScrollBar=░■▲▼
ScrollBar=░■▲▼◄►
ViewButtons=^↓○[]
CheckBox=[] X?
Radio=() *

View File

@ -134,7 +134,7 @@ func SliceColorized(str string, start, end int) string {
parser := NewColorParser(str, term.ColorBlack, term.ColorBlack)
var out string
for {
if curr >= end {
if end != -1 && curr >= end {
break
}
elem := parser.NextElement()

View File

@ -130,7 +130,7 @@ func (s *ThemeManager) Reset() {
defTheme.objects[ObjSingleBorder] = "─│┌┐└┘"
defTheme.objects[ObjDoubleBorder] = "═║╔╗╚╝"
defTheme.objects[ObjEdit] = "←→V"
defTheme.objects[ObjScrollBar] = "░■▲▼"
defTheme.objects[ObjScrollBar] = "░■▲▼◄►"
defTheme.objects[ObjViewButtons] = "^↓○[]"
defTheme.objects[ObjCheckBox] = "[] X?"
defTheme.objects[ObjRadio] = "() *"

View File

@ -59,7 +59,7 @@ ButtonDisabledBack=white
SingleBorder=─│┌┐└┘
DoubleBorder=═║╔╗╚╝
Edit=←→V
ScrollBar=░■▲▼
ScrollBar=░■▲▼◄►
ViewButtons=^↓○[]
CheckBox=[] X?
Radio=() *