From 23dfd96a877dadf4a6c36f39785f2b000139491b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 8 Feb 2025 14:04:11 -0600 Subject: [PATCH] changing Height() to reflect more realistic values --- size.go | 2 -- structs.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/size.go b/size.go index 91b6f81..68dcf38 100644 --- a/size.go +++ b/size.go @@ -258,9 +258,7 @@ func (tk *guiWidget) setFullSize() bool { tk.full.h1 = tk.full.h0 + 1 } if tk.isWindowDense() && tk.isInGrid() { - // if tk.full.Height() > 0 { tk.full.h1 = tk.full.h0 - // } } if changed { tk.dumpWidget(fmt.Sprintf("setFullSize(changed)")) diff --git a/structs.go b/structs.go index f096e2a..565ce28 100644 --- a/structs.go +++ b/structs.go @@ -130,6 +130,19 @@ func (r *rectType) Width() int { } func (r *rectType) Height() int { + if r.h0 == 0 && r.h1 == 0 { + // edge case. only return 0 for these + return 0 + } + if r.h1 == r.h0 { + // if they are equal, it's actually height = 1 + return 1 + } + if r.h1-r.h0 < 1 { + // can't have negatives. something is wrong. return 1 for now + return 1 + } + return r.h1 - r.h0 }