mirror of
https://github.com/VladimirMarkelov/clui.git
synced 2025-04-26 13:49:01 +08:00
better horizontal scroll draw support
This commit is contained in:
parent
9fb3d3174e
commit
54bead63d9
10
canvas.go
10
canvas.go
@ -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++ {
|
||||
|
@ -16,7 +16,7 @@ ProgressActiveText = white
|
||||
SingleBorder=-|++++
|
||||
DoubleBorder==|++++
|
||||
Edit=<>V
|
||||
ScrollBar=|O^V
|
||||
ScrollBar=|O^V<>
|
||||
ViewButtons=^_X[]
|
||||
CheckBox=[] X?
|
||||
Radio=() *
|
||||
|
@ -58,7 +58,7 @@ ButtonDisabledBack=white
|
||||
SingleBorder=─│┌┐└┘
|
||||
DoubleBorder=═║╔╗╚╝
|
||||
Edit=←→V
|
||||
ScrollBar=░■▲▼
|
||||
ScrollBar=░■▲▼◄►
|
||||
ViewButtons=^↓○[]
|
||||
CheckBox=[] X?
|
||||
Radio=() *
|
||||
|
@ -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()
|
||||
|
2
theme.go
2
theme.go
@ -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] = "() *"
|
||||
|
@ -59,7 +59,7 @@ ButtonDisabledBack=white
|
||||
SingleBorder=─│┌┐└┘
|
||||
DoubleBorder=═║╔╗╚╝
|
||||
Edit=←→V
|
||||
ScrollBar=░■▲▼
|
||||
ScrollBar=░■▲▼◄►
|
||||
ViewButtons=^↓○[]
|
||||
CheckBox=[] X?
|
||||
Radio=() *
|
||||
|
Loading…
x
Reference in New Issue
Block a user