diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-09 15:20:56 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-09 15:20:56 -0500 |
| commit | 462331590c8929bc2f1eb6266c701ff319dd38c3 (patch) | |
| tree | c6dbfe4d3ef6a6cffae494c69e46faa9268ddb15 /tui | |
| parent | ed7f662431a8e29a4ed27805c174ee72b4a7346a (diff) | |
only open history view if message is not onscreen
Diffstat (limited to 'tui')
| -rw-r--r-- | tui/layout.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tui/layout.go b/tui/layout.go index d230a87..1cd3124 100644 --- a/tui/layout.go +++ b/tui/layout.go @@ -23,6 +23,7 @@ type Box struct { computedSize [2]int computedRect rect isOverflow bool + isVisible bool mouseEvent MouseEvent contextMenu []string } @@ -97,6 +98,14 @@ func Pop() { } } +func IsVisible(id string) bool { + b := layout.back[id] + if b != nil { + return b.isVisible + } + return false +} + func (b Box) axes() [2]BoxSize { return [2]BoxSize {b.Width, b.Height} } @@ -372,6 +381,8 @@ func (b *Box) drawComputed( bMax := b.computedRect.max[i] - b.Margins[i * 2 + 1] viewRect.max[i] = min(bMax, parentRect.max[i]) } + b.isVisible = viewRect.max[0] - viewRect.min[0] > 0 && + viewRect.max[1] - viewRect.min[1] > 0 style := parentStyle if b.Style != nil { |
