feat(highlights): position-based text highlighting#340
Closed
kdroidFilter wants to merge 1 commit into
Closed
Conversation
d1e0ed4 to
b5e14a5
Compare
- Add character offset tracking for precise highlight positioning - Preserve highlight position when toggling nikud/taamim visibility - Improve highlight color picker UI in context menu - Use proper menu item colors for icons and text
c88c85f to
ae66dda
Compare
Owner
Author
|
Réimplémenté proprement : surlignage position-based persisté dans une BDD utilisateur locale dédiée (store injecté via DI au lieu de l'objet global en mémoire), sélection multi-lignes et mapping diacritiques gérés. Remplacé par le commit fb0a2b9. |
Owner
Author
|
Reimplemented cleanly: position-based highlights are now persisted in a dedicated local user DB (DI-injected store instead of the in-memory global object), with multi-line selection and diacritics-offset mapping handled. Superseded by commit fb0a2b9. |
kdroidFilter
added a commit
that referenced
this pull request
Jun 4, 2026
Add per-line text highlighting backed by a dedicated, read-only-books-independent user database (UserSettingsDb), reworking PR #340 from an in-memory global object into a DI-injected, persistence-backed store. - UserHighlights.sq / LineNotes.sq: new tables in the local user DB (added for existing users via CREATE TABLE IF NOT EXISTS, no migration needed) - HighlightStore: per-book in-memory cache (StateFlow) with write-through to SQLite; Color<->Int; offsets keyed by stable lineId so highlights survive DB delta updates - HighlightSelectionResolver: resolves a (multi-line) selection to per-line ranges by splitting on line breaks and anchoring segments to visible lines; diacritics-aware - Highlighting.applyUserHighlights + HebrewSearch helpers (stripNikudTeamimWithMap) aligned with removeAllDiacritics so offsets match the rendered text (keeps geresh/ gershayim), without touching the search-shared stripDiacriticsWithMap - BookContentScreen: context-menu color-swatch picker (+ clear) writing to the store - BookContentView: per-line highlights grouped once and passed as the stable emptyList() singleton for unhighlighted lines, so a toggle only recomposes the affected line (cuts recomposition allocations ~95%) - DI: single shared UserSettingsDb instance injected into all user stores, replacing the previous per-store driver creation - LineNoteStore + schema: foundation for upcoming per-line notes (not yet wired to UI)
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
LineTextRegistryto track visible line content for position lookupTechnical Details
UserHighlight(lineId, startOffset, endOffset, color)applyUserHighlightsto use position offsetsNote
Highlights are currently in-memory only and will be lost when the app closes.
Follow-up: Persistence Implementation
To persist highlights to
UserSettingsDb, the following changes are needed:1. Create
UserHighlights.sqLocation:
SeforimApp/src/commonMain/sqldelight/io/github/kdroidfilter/seforimapp/db/2. Create
HighlightRepository.ktFollow the pattern of
CategoryDisplaySettingsStore:UserSettingsDbColor↔Int(usingcolor.toArgb()andColor(argb))3. Modify
HighlightStore.ktHighlightRepositoryaddHighlight()/removeHighlight()Test plan