Show a todo list the item a search found it by - #124
Merged
Merged
Conversation
The branch that renders a search excerpt sits behind isChecklist(), so a list found by its fifth item showed its first two and "+3 more". Replacing the layer with the excerpt was not an option — those are real checkboxes — so the window of visible items slides to the match instead. The tags do the same. The position written back is offset by the window: the template counts within it, and ticking the first visible box would otherwise have edited the first item of the list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #117.
#35 gave every card the line that put it in the results. Every card except a todo
list, where the branch is unreachable:
And the items shown were picked without consulting the search:
items.slice(0, 2).So a list that matched on its fifth item showed its first two and
+3 more.A window, not a replacement
.card-itemsis a siblinglayer carrying real checkboxes — a card can be ticked without opening it, and
07-checklistsdrives that. The window of visible items slides to the matchinstead: same order, same boxes, the card simply scrolled to the right place.
The tags do the same, so a note found by its third tag shows that tag rather than
its first two.
The trap that would have lost data
The template counts within the window; the position written back is the one in
the note. They were the same number while the window always started at zero. With
it sliding, ticking the first visible box would have ticked the first item of the
list — a card silently editing a line the user never saw.
onItemToggleoffsets by the window start, and there is a test on it in bothsuites. Checked by removing the offset: red in the unit suite.
Finding the item behind a clipped excerpt
The excerpt is cut at 160 characters and gains a trailing
…, so a long item neverequals its own text. Matched on the prefix, with a test.
Checked locally
npm test980 passing,npm run lintclean,npm run test:e2e15/15 in 4:15.🤖 Generated with Claude Code