Working some things out

This commit is contained in:
2025-08-14 14:21:19 -05:00
parent a74cf9fe61
commit acfe8be93d
9 changed files with 193 additions and 104 deletions

View File

@@ -28,7 +28,6 @@ import (
"github.com/gdamore/tcell"
)
// TODO: Make sure this works right... I don't think it does.
type DebugWidget struct {
id string
style tcell.Style
@@ -50,7 +49,9 @@ type DebugWidget struct {
var _ Widget = (*DebugWidget)(nil)
func NewDebugWidget(id string, s tcell.Style) *DebugWidget {
ret := &DebugWidget{}
ret := &DebugWidget{
widget: NewBlankWidget(fmt.Sprintf("%s-placeholder", id)),
}
ret.Init(id, s)
return ret
}
@@ -86,16 +87,19 @@ func (w *DebugWidget) HandleResize(ev *tcell.EventResize) {
w.h = sh
}
nX, nY := 1, 1
if w.w > 9 {
nX = 2
if w.drawRulers {
nX, nY := 1, 1
if w.w > 9 {
nX = 2
}
if w.h > 9 {
nY = 2
}
w.mTL = Coord{X: nX, Y: nY}
w.mBR = Coord{X: 1, Y: 1}
} else {
w.mTL, w.mBR = Coord{X: 0, Y: 0}, Coord{X: 0, Y: 0}
}
if w.h > 9 {
nY = 2
}
w.mTL = Coord{X: nX, Y: nY}
w.mBR = Coord{X: 1, Y: 1}
w.widget.SetPos(w.mTL)
w.widget.HandleResize(tcell.NewEventResize(w.w-w.mTL.X-w.mBR.X, w.h-w.mTL.Y-w.mBR.Y))
}
@@ -107,12 +111,13 @@ func (w *DebugWidget) Draw(screen tcell.Screen) {
if !w.visible {
return
}
st := w.style
if !w.active {
st = st.Dim(true)
}
st := w.style.Dim(!w.active)
wh.Border(w.x+w.mTL.X-1, w.y+w.mTL.Y-1, w.x+w.w+w.mBR.X+1, w.y+w.h+w.mBR.Y+1, wh.BRD_CSIMPLE, st, screen)
if w.drawRulers {
wh.Border(w.x+w.mTL.X-1, w.y+w.mTL.Y-1, w.x+w.w+w.mBR.X+1, w.y+w.h+w.mBR.Y+1, wh.BRD_CSIMPLE, st, screen)
} else {
wh.Border(w.x, w.y, w.x+w.w, w.y+w.h, wh.BRD_CSIMPLE, st, screen)
}
if w.drawRulers {
// X Ruler