Repository navigation
The desktop app searches messages, everywhere or in one chat, and opens a found message in its chat - #182
Conversation
…ns a found message in its chat
# Conflicts: # core/desktop/src/app/mod.rs # core/desktop/src/app/view.rs # core/desktop/src/demo.rs # core/desktop/src/main.rs
…eep jump is let go at the newest message
Review findings and fixesI merged main first (#180 message actions, then #181 files). Both sides are kept: the search's Found while writing the tests, worse than finding 1:
One more interaction, found while merging main: opening a found message used to bump Rulings noted: Search in Chat's visible entry comes with Chat Options (#143), and ⌘F from the composer stays. Checks (from
|
What changed
The desktop app's sidebar search now works like the Mac app's (
SidebarView.swift,Search.swift,AppStore's search):searchfinds (up to 50, newest first): the chat's picture and name, the time, and the sender (in groups, or "You") before the snippet, with the matches in bold, on two lines at most. While it's on its way it says "Searching…"; then "No messages found" or "Search failed: …". The old filter on chat names and last messages is gone, and so is its "No chats found".count_newer, thenmessages), scrolls to it and outlines its bubble in yellow for 2 seconds. A message more than 10,000 back says "That message is too far back to show yet.", as on the Mac. A result whose message disappears (its timer runs out, or it's deleted for everyone) leaves the list. Once the timeline is back at its newest message, the chat loads only its newest page again.The code is in its own module,
core/desktop/src/app/search.rs.app/mod.rsandapp/view.rsonly hook it in: the field's events, where the sidebar lists chats and results, the arrows, the bubble's outline, and the timeline's load depth.Paging back (#142)
Jumping needs only the part of #142 that loads older messages: the open chat now loads its newest
depthmessages. That'sPAGE(100) normally, back to the found message after a jump, andPAGEagain once the timeline is back at its newest message. The reload loop reads the wanted depth on each round, and a page fetched for a shallower depth than is now wanted is fetched again rather than shown. Scrolling back by itself still loads nothing older; #142 adds that.Shortcuts (marked in the code or listed here)
MessageScrollerStatecan only scroll to the top of a row.How it was tested
search.rs; each failed before the code): name matching, which chats a search lists (archived ones included; none in a chat search), snippet markers to bold ranges, the sender prefix, arrow stepping and its ends, the load depth and the too-far-back limit, and which chat ↩ opens.search.rs,window_tests; each failed before its fix): the realHush(its demo, no core) in a headless GPUI test window, with real keystrokes and actions. They cover ⌘F with nothing focused and from the composer, ⇧⌘F, both menu actions, ⇧⌘F with a dialog open, Esc with text and then on an empty field, and the load depth going back toPAGEat the newest message. They need GPUI's test support, whichsnapshotturns on.cargo test -p hush-desktop: 61 passed.cargo test -p hush-desktop --features snapshot: 65 passed.cargo fmt --check,cargo clippy -p hush-desktop --all-targets -- -D warnings, the same with--features snapshot: clean.sig-coreis untouched.--snapshot, light and dark), with two new screens:search: "book" across every chat. The "Chats" section has Book club and the archived Book swap; the "Messages" section has four results, bold matches, "You:" and group senders, and a third line cut with an ellipsis.search-in-chat: "bring" in Family. The "In Family / All Chats" row, two results with the first one picked, and the opened message's bubble outlined in yellow in the timeline.chat: the normal chat list (Pinned / Chats sections) is unchanged, and the archived demo chat doesn't show there.cfg!.Closes #141
Part of #157