Let the pane that fills take the room, and a viewport the height it is in
Filling a parent's cross axis got the header and the compose bar their width and left the backlog exactly as it was, because the backlog is not in a column — it is one pane of a ROW, beside the people panel, and in a row the space to be taken is along the axis and :cross takes none of it. :fill-height is how frq says which pane that is, and it was one of the props this dropped. It reads as :both despite the name: a pane that fills the height of a row it does not fill the width of is not what anyone means by it, and the panes that do NOT ask for it stay :cross and keep their own size, which is what leaves the slack there to be taken. The people panel is the one that does not ask, and it is empty until somebody opens it. :width-request is a minimum on a container too — the backlog asks for one only while the people panel is beside it. And a viewport with no :height of its own now takes what its column has left, less whatever must stay behind for the compose bar. Two hundred points was a default standing in for a measurement; it is still the answer on the first frame, before the column knows its own height. Reproduced frq's actual shape to find this — a row holding a fill-height column and a people pane that is empty until asked for — rather than the plain column the first repro used, which is why the first repro looked fixed and the app did not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5fcbb42 parent: e72d7b0 modified
glimmer-backends/glimmer-jvui/src/glimmer_jvui/core.clj +16 -0 | @@ -86,6 +86,22 @@ | ||
| 86 | 86 | ;; a share of the slack, and a line of buttons would stretch to |
| 87 | 87 | ;; fill the window. |
| 88 | 88 | :expand :cross} |
| 89 | + ;; :fill-height is frq's way of saying "this is the pane that takes | |
| 90 | + ;; what is left". It is the messages column in the row that also | |
| 91 | + ;; holds the people panel, and without it that column claims no slack | |
| 92 | + ;; at all — the backlog ends up as wide as the widest message and the | |
| 93 | + ;; scrollbar sits in the middle of the window. | |
| 94 | + ;; | |
| 95 | + ;; :both rather than :vertical, despite the name: in a ROW the space | |
| 96 | + ;; to be taken is horizontal, and a pane that fills the height of a | |
| 97 | + ;; row it does not fill the width of is not what anyone means by it. | |
| 98 | + ;; The panes that do NOT ask for it stay :cross and keep their own | |
| 99 | + ;; size, which is what leaves the slack to be taken. | |
| 100 | + (:fill-height props) (assoc :expand :both) | |
| 101 | + ;; A minimum, not a size: the messages column asks for one only while | |
| 102 | + ;; the people panel is beside it. | |
| 103 | + (:width-request props) | |
| 104 | + (assoc :min-size [(num (:width-request props) 0.0) 0.0]) | |
| 89 | 105 | (:spacing props) (assoc :spacing (num (:spacing props) 0.0)) |
| 90 | 106 | (:padding props) (assoc :padding (num (:padding props) 0.0)) |
| 91 | 107 | (:margin props) (assoc :margin (num (:margin props) 0.0)) |
| @@ -86,6 +86,22 @@ | |||
| 86 | ;; a share of the slack, and a line of buttons would stretch to | 86 | ;; a share of the slack, and a line of buttons would stretch to |
| 87 | ;; fill the window. | 87 | ;; fill the window. |
| 88 | :expand :cross} | 88 | :expand :cross} |
| 89 | + ;; :fill-height is frq's way of saying "this is the pane that takes | ||
| 90 | + ;; what is left". It is the messages column in the row that also | ||
| 91 | + ;; holds the people panel, and without it that column claims no slack | ||
| 92 | + ;; at all — the backlog ends up as wide as the widest message and the | ||
| 93 | + ;; scrollbar sits in the middle of the window. | ||
| 94 | + ;; | ||
| 95 | + ;; :both rather than :vertical, despite the name: in a ROW the space | ||
| 96 | + ;; to be taken is horizontal, and a pane that fills the height of a | ||
| 97 | + ;; row it does not fill the width of is not what anyone means by it. | ||
| 98 | + ;; The panes that do NOT ask for it stay :cross and keep their own | ||
| 99 | + ;; size, which is what leaves the slack to be taken. | ||
| 100 | + (:fill-height props) (assoc :expand :both) | ||
| 101 | + ;; A minimum, not a size: the messages column asks for one only while | ||
| 102 | + ;; the people panel is beside it. | ||
| 103 | + (:width-request props) | ||
| 104 | + (assoc :min-size [(num (:width-request props) 0.0) 0.0]) | ||
| 89 | (:spacing props) (assoc :spacing (num (:spacing props) 0.0)) | 105 | (:spacing props) (assoc :spacing (num (:spacing props) 0.0)) |
| 90 | (:padding props) (assoc :padding (num (:padding props) 0.0)) | 106 | (:padding props) (assoc :padding (num (:padding props) 0.0)) |
| 91 | (:margin props) (assoc :margin (num (:margin props) 0.0)) | 107 | (:margin props) (assoc :margin (num (:margin props) 0.0)) |
modified
jvui/src/jvui/widgets.clj +7 -4 | @@ -429,10 +429,13 @@ | ||
| 429 | 429 | avail (c/avail-height) |
| 430 | 430 | h (double (cond |
| 431 | 431 | (:height opts) (:height opts) |
| 432 | - ;; `:reserve` says how much must be left for whatever | |
| 433 | - ;; sits below — a compose bar — rather than giving the | |
| 434 | - ;; viewport a height of its own. | |
| 435 | - (and reserve (pos? avail)) (max 0.0 (- avail (double reserve))) | |
| 432 | + ;; With no height of its own a viewport takes what the | |
| 433 | + ;; column has left, less whatever must stay behind for | |
| 434 | + ;; the compose bar under it. Two hundred is only the | |
| 435 | + ;; answer before anything has a size — on the first | |
| 436 | + ;; frame, when the column does not know its own height | |
| 437 | + ;; yet. | |
| 438 | + (pos? avail) (max 0.0 (- avail (double (or reserve 0.0)))) | |
| 436 | 439 | :else 200.0)) |
| 437 | 440 | id (c/next-id (:key opts)) |
| 438 | 441 | area (or scroll-key id) |
| @@ -429,10 +429,13 @@ | |||
| 429 | avail (c/avail-height) | 429 | avail (c/avail-height) |
| 430 | h (double (cond | 430 | h (double (cond |
| 431 | (:height opts) (:height opts) | 431 | (:height opts) (:height opts) |
| 432 | - ;; `:reserve` says how much must be left for whatever | 432 | + ;; With no height of its own a viewport takes what the |
| 433 | - ;; sits below — a compose bar — rather than giving the | 433 | + ;; column has left, less whatever must stay behind for |
| 434 | - ;; viewport a height of its own. | 434 | + ;; the compose bar under it. Two hundred is only the |
| 435 | - (and reserve (pos? avail)) (max 0.0 (- avail (double reserve))) | 435 | + ;; answer before anything has a size — on the first |
| 436 | + ;; frame, when the column does not know its own height | ||
| 437 | + ;; yet. | ||
| 438 | + (pos? avail) (max 0.0 (- avail (double (or reserve 0.0)))) | ||
| 436 | :else 200.0)) | 439 | :else 200.0)) |
| 437 | id (c/next-id (:key opts)) | 440 | id (c/next-id (:key opts)) |
| 438 | area (or scroll-key id) | 441 | area (or scroll-key id) |