Wire scrollback search UI to the FTS5 index#30
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cmd+Shift+Fnow queries the FTS5 index from Add SQLite FTS5 scrollback index (no UI yet) #29 instead of doing an in-memory substring scan over currently-loaded messages. Searches every persisted message, not just what happens to be in@Observablemodel state right now."foo bar"), prefix (bar*), boolean (term1 AND term2 NOT term3), column-scoped (sender:alice) — by passing the input through verbatim. The text-field placeholder advertises the syntax so users discover it without docs.Changes
Sources/Brygga/Views/ContentView.swift—GlobalFindSheetrewritten end-to-end:GlobalFindMatchsubstring-scan plumbing. Holds@State private var hits: [SearchHit]instead, populated via.task(id:)that re-runs on every query or scope change with a 120ms debounce.ScopeUIenum + segmentedPicker. TheThis server/This channelsegments are disabled when there's no matching selection, so the picker can't silently downgrade behavior.SearchHitRow(private) replacesGlobalFindMatchRow. RendersserverName / target · timestampand a 2-linehit.contentexcerpt.open(_:)resolves(serverID, target)back to a channel for navigation, with sensible fallbacks: server-console hits land on the server row; hits whose target was closed since indexing land on the parent server row rather than no-op'ing.Test plan
swift build— passesswift test— 131 tests pass (no test changes; UI is exercised by build + manual)swiftformat --lint .— cleanCmd+Shift+Fopens the new sheet. Default scope is "All servers"."foo bar"(phrase),connect*(prefix),term1 AND term2 NOT term3(boolean),sender:alice(column-scoped) — all work as documented.closePrivateMessage).Risk / rollback
channel.messagesarray (typically the last 500 lines after rehydrate). New search hits the full persisted index, so users will see more results — by design, but worth flagging for muscle-memory.MessageBufferView(NSTextView-backed) and is a separate PR.