mirror of
https://github.com/VladimirMarkelov/clui.git
synced 2025-04-26 13:49:01 +08:00
fix title display for Frame
This commit is contained in:
parent
a83e4ab41b
commit
bc8d1ba9f9
12
frame.go
12
frame.go
@ -99,10 +99,10 @@ func (f *Frame) Draw() {
|
|||||||
defer PopAttributes()
|
defer PopAttributes()
|
||||||
|
|
||||||
x, y, w, h := f.Clipper()
|
x, y, w, h := f.Clipper()
|
||||||
|
fx, fy := f.Pos()
|
||||||
|
fw, fh := f.Size()
|
||||||
|
|
||||||
if f.scrollable {
|
if f.scrollable {
|
||||||
_, fy := f.Pos()
|
|
||||||
_, fh := f.Size()
|
|
||||||
_, fpy := f.Paddings()
|
_, fpy := f.Paddings()
|
||||||
|
|
||||||
var dist float64
|
var dist float64
|
||||||
@ -145,17 +145,15 @@ func (f *Frame) Draw() {
|
|||||||
|
|
||||||
SetTextColor(fg)
|
SetTextColor(fg)
|
||||||
SetBackColor(bg)
|
SetBackColor(bg)
|
||||||
fx, fy := f.Pos()
|
|
||||||
fw, fh := f.Size()
|
|
||||||
DrawFrame(fx, fy, fw, fh, f.border)
|
DrawFrame(fx, fy, fw, fh, f.border)
|
||||||
|
|
||||||
if f.title != "" {
|
if f.title != "" {
|
||||||
str := f.title
|
str := f.title
|
||||||
raw := UnColorizeText(str)
|
raw := UnColorizeText(str)
|
||||||
if xs.Len(raw) > w-2 {
|
if xs.Len(raw) > fw-2 {
|
||||||
str = SliceColorized(str, 0, w-2-3) + "..."
|
str = SliceColorized(str, 0, fw-2-3) + "..."
|
||||||
}
|
}
|
||||||
DrawText(x+1, y, str)
|
DrawText(fx+1, fy, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
f.DrawChildren()
|
f.DrawChildren()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user