v0.1.6 tui clipped box, scrollbar, and keyvalue improvements, single column document widget added

This commit is contained in:
2026-08-13 08:44:17 -04:00
parent 3d9631d1db
commit c246f38170
6 changed files with 362 additions and 210 deletions
+13 -1
View File
@@ -104,4 +104,16 @@ func (v *ViewportScroll) ClipToViewport(y, h int) (viewY, viewH, contentOffset i
}
return viewY, viewH, contentOffset, viewH > 0
}
}
// EnsureRange scrolls the least distance that brings a content row range into
// view; a range taller than the viewport is top-aligned
func (v *ViewportScroll) EnsureRange(y, h int) {
switch {
case h >= v.ViewportH || y < v.Offset:
v.Offset = y
case y+h > v.Offset+v.ViewportH:
v.Offset = y + h - v.ViewportH
}
v.clamp()
}