fix(compact): size the window to the strip instead of a tuned constant

compactH was 158px, "tuned so the compact entry strip fits in a single row".
A constant tuned against a layout stops being true the moment the layout
changes, and this one outlived a strip that had since shrunk — leaving about
70px of empty window under the fields.

The frontend now measures what it rendered and asks for that height, watched by
a ResizeObserver so a strip that wraps at a narrow width is followed too. The
topbar is added as its declared h-8 rather than measured, since it is fixed.

Bounded in the backend: a measurement of zero — a layout not yet painted —
must not collapse the window, and the call is ignored unless compact is on so
nothing can shrink the normal window. Rounded to whole pixels so a sub-pixel
reflow cannot start a resize loop.
This commit is contained in:
2026-08-13 11:54:09 +02:00
parent 8fccfa29b1
commit 93879a0ce1
5 changed files with 60 additions and 4 deletions
+26
View File
@@ -17774,3 +17774,29 @@ func (a *App) SetSpotTTLMinutes(min int) error {
a.setSetting(keyClusterSpotTTL, strconv.Itoa(min))
return nil
}
// SetCompactHeight resizes the compact window to fit its content.
//
// The height used to be a constant "tuned so the compact entry strip fits in a
// single row". Constants tuned against a layout stop being true the moment the
// layout changes, and this one outlived a strip that had since lost a row —
// leaving a band of empty window under the fields. The frontend measures what
// it actually rendered and says so.
//
// Ignored unless compact is on, so nothing can shrink the normal window.
func (a *App) SetCompactHeight(h int) {
if a.ctx == nil || !a.compact {
return
}
// Bounded: a measurement of zero (a layout not yet painted) must not collapse
// the window to nothing, and no strip is ever 600px tall.
if h < 80 || h > 600 {
return
}
w, _ := wruntime.WindowGetSize(a.ctx)
if w <= 0 {
w = compactW
}
wruntime.WindowSetMinSize(a.ctx, 900, h)
wruntime.WindowSetSize(a.ctx, w, h)
}