Leave the compose bar where the reader last saw it
The jump button's row is now always there — a spacer of its height when the button is not in it — and the scroll reserves the same space either way. The reserve used to vary with the button, which moved the compose bar up and down under the reader every time the view drifted from the end and back. And the combo sits lower: the chat's bottom margin is smaller than the space above it, which is where a row at the bottom of a screen wants its room. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cbbcecd parent: 68afa6f modified
src/frq/app.jolt +13 -7 | @@ -344,17 +344,20 @@ | ||
| 344 | 344 | ;; Not a :page — a page scrolls everything, which would carry the compose |
| 345 | 345 | ;; bar off the bottom with the backlog. The message list is the only thing |
| 346 | 346 | ;; that scrolls, bounded so what follows it keeps its room. |
| 347 | - [:vbox {:spacing 8 :margin 12} | |
| 347 | + ;; Less room under the compose row than around it: the space a row at the | |
| 348 | + ;; bottom of a screen wants is above it, not beneath it. | |
| 349 | + [:vbox {:spacing 8 :margin 12 :margin-bottom 4} | |
| 348 | 350 | [:hbox {:spacing 8} |
| 349 | 351 | [:button {:label "← Chats" :on-click #(reset! s/screen :chats)}] |
| 350 | 352 | [:title {:label (or name "Chat")}]] |
| 351 | 353 | [error-note] |
| 352 | - ;; :reserve leaves room for what sits below — the separator and compose | |
| 353 | - ;; bar, and the jump button when it is there. A reserve that does not | |
| 354 | - ;; count the button is a list that grows over the compose bar and pushes | |
| 355 | - ;; it off the bottom of the window the moment the button appears. | |
| 354 | + ;; :reserve leaves room for everything below: the jump button's row, the | |
| 355 | + ;; separator and the compose bar. It does not vary with whether the button | |
| 356 | + ;; is showing, and neither does that row — a reserve that changed would | |
| 357 | + ;; move the compose bar under the reader every time the button came and | |
| 358 | + ;; went. | |
| 356 | 359 | [:scroll {:orientation :vertical |
| 357 | - :reserve (if @s/at-present? 72 116) | |
| 360 | + :reserve 116 | |
| 358 | 361 | :stick-to-bottom true |
| 359 | 362 | :scroll-to-bottom @s/jump-tick |
| 360 | 363 | :on-change #(reset! s/at-present? (= "end" %))} |
| @@ -363,8 +366,11 @@ | ||
| 363 | 366 | [:dim-label {:label "Nothing here yet."}])] |
| 364 | 367 | ;; Only while it is needed, and directly above the compose bar: the way |
| 365 | 368 | ;; back to the present belongs next to the thing that puts you there. |
| 369 | + ;; The row keeps its height whether or not the button is in it, so the | |
| 370 | + ;; compose bar below stays where the reader last saw it. | |
| 366 | 371 | [:vbox {:key :jump} |
| 367 | - (when-not @s/at-present? | |
| 372 | + (if @s/at-present? | |
| 373 | + [:spacer {:size 34}] | |
| 368 | 374 | [:button {:label "↓ Jump to present" :on-click s/jump-to-present!}])] |
| 369 | 375 | [:separator {}] |
| 370 | 376 | [:hbox {:spacing 8} |
| @@ -344,17 +344,20 @@ | |||
| 344 | ;; Not a :page — a page scrolls everything, which would carry the compose | 344 | ;; Not a :page — a page scrolls everything, which would carry the compose |
| 345 | ;; bar off the bottom with the backlog. The message list is the only thing | 345 | ;; bar off the bottom with the backlog. The message list is the only thing |
| 346 | ;; that scrolls, bounded so what follows it keeps its room. | 346 | ;; that scrolls, bounded so what follows it keeps its room. |
| 347 | - [:vbox {:spacing 8 :margin 12} | 347 | + ;; Less room under the compose row than around it: the space a row at the |
| 348 | + ;; bottom of a screen wants is above it, not beneath it. | ||
| 349 | + [:vbox {:spacing 8 :margin 12 :margin-bottom 4} | ||
| 348 | [:hbox {:spacing 8} | 350 | [:hbox {:spacing 8} |
| 349 | [:button {:label "← Chats" :on-click #(reset! s/screen :chats)}] | 351 | [:button {:label "← Chats" :on-click #(reset! s/screen :chats)}] |
| 350 | [:title {:label (or name "Chat")}]] | 352 | [:title {:label (or name "Chat")}]] |
| 351 | [error-note] | 353 | [error-note] |
| 352 | - ;; :reserve leaves room for what sits below — the separator and compose | 354 | + ;; :reserve leaves room for everything below: the jump button's row, the |
| 353 | - ;; bar, and the jump button when it is there. A reserve that does not | 355 | + ;; separator and the compose bar. It does not vary with whether the button |
| 354 | - ;; count the button is a list that grows over the compose bar and pushes | 356 | + ;; is showing, and neither does that row — a reserve that changed would |
| 355 | - ;; it off the bottom of the window the moment the button appears. | 357 | + ;; move the compose bar under the reader every time the button came and |
| 358 | + ;; went. | ||
| 356 | [:scroll {:orientation :vertical | 359 | [:scroll {:orientation :vertical |
| 357 | - :reserve (if @s/at-present? 72 116) | 360 | + :reserve 116 |
| 358 | :stick-to-bottom true | 361 | :stick-to-bottom true |
| 359 | :scroll-to-bottom @s/jump-tick | 362 | :scroll-to-bottom @s/jump-tick |
| 360 | :on-change #(reset! s/at-present? (= "end" %))} | 363 | :on-change #(reset! s/at-present? (= "end" %))} |
| @@ -363,8 +366,11 @@ | |||
| 363 | [:dim-label {:label "Nothing here yet."}])] | 366 | [:dim-label {:label "Nothing here yet."}])] |
| 364 | ;; Only while it is needed, and directly above the compose bar: the way | 367 | ;; Only while it is needed, and directly above the compose bar: the way |
| 365 | ;; back to the present belongs next to the thing that puts you there. | 368 | ;; back to the present belongs next to the thing that puts you there. |
| 369 | + ;; The row keeps its height whether or not the button is in it, so the | ||
| 370 | + ;; compose bar below stays where the reader last saw it. | ||
| 366 | [:vbox {:key :jump} | 371 | [:vbox {:key :jump} |
| 367 | - (when-not @s/at-present? | 372 | + (if @s/at-present? |
| 373 | + [:spacer {:size 34}] | ||
| 368 | [:button {:label "↓ Jump to present" :on-click s/jump-to-present!}])] | 374 | [:button {:label "↓ Jump to present" :on-click s/jump-to-present!}])] |
| 369 | [:separator {}] | 375 | [:separator {}] |
| 370 | [:hbox {:spacing 8} | 376 | [:hbox {:spacing 8} |