Skip to content

The desktop app pages back through older messages and moves between chats from the keyboard - #189

Merged
pitis merged 4 commits into
mainfrom
feat/desktop-paging
Nov 14, 2026
Merged

pitis merged 4 commits into
mainfrom
feat/desktop-paging

Conversation

@pitis

@pitis pitis commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changed

Paging back (core/desktop/src/app/paging.rs, on #182's load depth)

  • Scrolled up to within 10 rows of the oldest loaded message, the timeline asks for 100 more (depth += PAGE), with a small spinner over its top while they load (the Mac app's ProgressView at the top of TimelineList). A load that returns fewer than asked for means the whole chat is in, so nothing more is asked. There is no cap: a chat's whole history can be scrolled.
  • The reader stays on their message while older rows come in above. The row diff (changed_rows in app/mod.rs) now gives one splice per run of rows that came or went, instead of one splice from the first change to the last. Before, a new message while scrolled up (the newest 100 load, so the oldest drops off and the new one comes in) replaced every row, and GPUI moved the reader to the top.
  • Back at the newest message, The desktop app searches messages, everywhere or in one chat, and opens a found message in its chat #182's back_to_newest drops the older pages again, as it does after a jump.
  • "New messages" pill: if a message from someone else comes in while scrolled up, an accent "New messages" pill with the down arrow shows at the timeline's bottom right, as on the Mac. It goes once the bottom is reached, or when another chat opens. A message of ours scrolls to the end (Timeline.onNewLastMessage). The always-on "Jump to latest" button is gone (the Mac has none).
  • Details read only when needed: a message's details (reactions, files, link previews) are read when its row comes in (a page, a new message) or when it changes (MessageChanged, AttachmentChanged), not for every loaded message on each load. Rows that go take their files, decoded pictures, recordings' lengths, link previews and their pictures, and reactions with them.
  • No page is asked for while a load is still on its way.
  • Performance: timeline rows are built only for the rows on screen (Hush::row, read from the app inside the list's row renderer), not for every loaded message on every redraw. Measured with a window test, debug build, minimum of 5 frames: 100 loaded messages 15.0 ms vs 5,000 loaded 49.3 ms before; 13.5 ms vs 13.4 ms after.

Keyboard (core/desktop/src/app/navigate.rs), the Mac app's Chats menu (HushApp.swift ChatCommands, ChatList.neighbor). ⌘ on macOS, Ctrl on Windows and Linux; ⌥ is Alt:

  • ⌘K Find Chat…, ⌥↑/⌥↓ Previous/Next Chat (wraps around), ⌥⇧↑/⌥⇧↓ Previous/Next Unread Chat (doesn't wrap), ⌘1–⌘9 Jump to Chat, ⇧⌘T Focus Composer, ⇧⌘C Close Chat (what was typed stays as the chat's draft). Each one lands in the chat's composer and does nothing while a dialog is open. The menu has the Mac's items in the Mac's order, with Attach Files… (The desktop app sends pictures and files #187) between Focus Composer and Close Chat.
  • ↑/↓ in the search field, when not stepping through found messages, open the chat above or below among the chats listed. The keys stay in the field (SidebarView.moveInSearch); The desktop app searches messages, everywhere or in one chat, and opens a found message in its chat #182 left this to this issue.
  • Opening a chat from the keys scrolls the chat list to its row.
  • On Linux, text fields bind Alt+Shift+↑/↓ to "add a cursor". The unread-chat shortcuts are also bound in the Input context so they win there.
  • select now goes through switch(Option<String>), so Close Chat takes the same path as opening a chat (draft kept, tray and files cleared, loads dropped). The desktop app searches messages, everywhere or in one chat, and opens a found message in its chat #182's global-action helper is shared (navigate::on) and the search shortcuts use it too.

Why

Closes #142. Part of #157.

How it was tested

  • cargo fmt --check; cargo clippy -p hush-desktop --all-targets -- -D warnings, and the same with --features snapshot; cargo test -p hush-desktop (93 passed) and cargo test -p hush-desktop --features snapshot (118 passed, including The desktop app searches messages, everywhere or in one chat, and opens a found message in its chat #182's and The desktop app shows formatted text and writes it, with mentions #186's window tests).
  • New window tests (headless GPUI window, real keys):
    • paging near the top, with the spinner, no second request while one loads, and a short page ending it
    • the reader staying on their message through a new message and an older page
    • the pill: shown, gone at the bottom, ours scrolling to the end, belonging to its chat
    • the 5,000-message frame time
    • ⌥↑/⌥↓, ⌥⇧↑/⌥⇧↓, ⌘1–9, ⌘K, ⇧⌘T, ⇧⌘C, the shortcuts waiting for a dialog, and ↑/↓ in the search field
  • Unit tests: neighbor (the Mac's ChatListTests cases) and the row diff. A property-style test checks that the splices turn the old list into the new one.
  • Each new test failed before its code: checked by stubbing out the paging logic, removing the bindings, and running the frame and scroll tests on the old code.
  • Snapshot: a new history screen (chat scrolled back, spinner, pill), light and dark. I checked it and the existing chat, files and search-in-chat screens.

Not tested: the live window and a linked phone (not linked here by design). That leaves real-database load times for deep pages unchecked; each page re-reads the chat's newest messages down to the oldest loaded, as #182's jump does. Linux's Alt+Shift binding precedence is from GPUI's keymap rules, not run on Linux. The native macOS menu (its submenu and key equivalents) doesn't render offscreen. make check needs the signing certificate this Mac doesn't have.

…hats from the keyboard

Scrolling up near the oldest loaded message loads the page before it, with a
spinner at the top; rows are built only for the messages on screen, and only the
rows that came or went are replaced, so the reader stays on their message. A
message that comes in while scrolled up shows the New messages pill (ours
scrolls to it). The Chats menu and its shortcuts follow the Mac app: Find Chat,
previous and next chat, unread ones, Jump to Chat 1-9, Focus Composer and Close
Chat; the arrows in the search field move through the chats listed.
With the review's fixes: a message's details are read only when its row comes
in or it changes; rows that go take their files, pictures, link previews and
reactions with them; no page is asked for while a load is on its way; the New
messages pill sits bottom right, as on the Mac, and the always-on jump button
goes; the attach shortcut uses the shared shortcut helper.
@pitis

pitis commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Review findings and fixes (after merging main with #188, link previews):

  1. Important: a deep scroll back re-read every loaded message's details. Fixed.
    • 1a. Which details are read. A message's details (reactions, files, link previews) are now read only when its row comes in or the message changes.

      • Rows that come in are taken from the row diff: a page, or a new message.
      • A change arrives as MessageChanged or AttachmentChanged, which carry the key.
      • Wanted keys collect in actions.wanted. One load runs at a time and reads what was asked for meanwhile before it ends. Generation checks are kept. Details for rows that went meanwhile are dropped.
      • Files and link previews now merge the details read instead of rebuilding from all loaded keys.
      • Test: a_page_or_a_changed_message_reads_only_its_own_details. It covers a first page, an older page, a changed message, a changed file, another chat's change, a message not loaded, and going back to the newest. It fails when every loaded row is read.
    • 1b. Pruning. When rows go (back to the newest, a sliding window), these go with them:

      • their files, decoded pictures (images dropped as clear_files does), recordings' lengths and unplayable marks
      • their link previews and preview pictures (the composer draft's picture stays)
      • their reactions and pending reactions

      A picture still decoding for a row that went is skipped. Tests: rows_that_go_take_their_pictures_and_lengths_with_them (files) and rows_that_go_take_their_reactions_with_them (actions), both failing before the fix. The previews unit tests now cover the pruning too.

  2. A page could be asked for while a back_to_newest reload was in flight. Fixed: the near-top check now also requires messages_loading != Some(generation). Test: no_page_is_asked_for_while_a_load_is_on_its_way, failing before the fix.
  3. attach.rs had its own deferred global-action helper. Fixed: it uses navigate::on.
  4. Owner's rulings. Done as decided:
    • the "New messages" pill now sits bottom right, 16 px in, as on the Mac (checked in the history snapshot, light and dark);
    • the always-on "Jump to latest" button is gone;
    • re-reading the newest messages down to the oldest shown stays a shortcut: on PAGE.

Checks run:

  • cargo fmt --check: passes.
  • cargo clippy -p hush-desktop --all-targets -- -D warnings, with and without --features snapshot: clean.
  • cargo test -p hush-desktop: 106 passed. With --features snapshot: 140 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The desktop app pages back through older messages and moves between chats from the keyboard

1 participant