aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/grid.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index 96da1cb..7f131bd 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -127,6 +127,15 @@ func (grid *Grid) Draw(ctx *Context) {
for _, row := range rows {
height += row.Size
}
+ if x+width > ctx.Width() {
+ width = ctx.Width() - x
+ }
+ if y+height > ctx.Height() {
+ height = ctx.Height() - y
+ }
+ if width <= 0 || height <= 0 {
+ continue
+ }
subctx := ctx.Subcontext(x, y, width, height)
cell.Content.Draw(subctx)
}