Bug: CodeView search jumps to the bottom on an offscreen match
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start by running the provided reproduction with @pierre/diffs 1.4.2, then trace how CodeView handles search-match navigation and renders the selected match. Check the fourth match at line 201 in the 800-line editable file. Done means selecting it scrolls the match into view, while search and manual scrolling remain usable.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have searched for duplicate or closed issues
- I have read the contributing guidelines
Describe the issue
In an editable CodeView with default options, the first three search matches work. Navigating to the fourth match (line 201) jumps to the bottom of the 800-line file instead. The search panel shows 4 of 4, but line 201 is not rendered.
Expected: The selected match scrolls into view, and search and manual scrolling remain usable.
Reproduction
- Mount the component below and click inside the text.
- Open search with Cmd/Ctrl+F and enter github.
- Press Enter three times to select the fourth match.
import type { CodeViewItem } from "@pierre/diffs";
import { Editor, type EditorFactory } from "@pierre/diffs/edit";
import { CodeView, EditProvider } from "@pierre/diffs/react";
const createEditor: EditorFactory<undefined, undefined> = (
editorType,
options,
editStateKey,
) => new Editor(editorType, options, editStateKey);
const matchLines = [125, 126, 128, 201];
const items: CodeViewItem<undefined>[] = [
{
id: "file",
type: "file",
edit: true,
version: 1,
file: {
name: "example.txt",
contents: Array.from({ length: 800 }, (_, index) =>
matchLines.includes(index + 1)
? `github match at ${index + 1}`
: `line ${index + 1}`,
).join("\n"),
},
},
];
export default function SearchReproduction() {
return (
<EditProvider createEditor={createEditor}>
<CodeView
items={items}
style={{ height: 560, overflow: "auto" }}
/>
</EditProvider>
);
}
What browser(s) are you seeing the problem on?
Chrome
What version of @pierre/diffs are you using?
1.4.2
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 226
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 34
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pierrecomputer/pierre
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1187 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1150 · 3 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 28/100
pierrecomputer/pierre#1190 ·
Maintainers usually reply within 1 day
-
Bug: Dragging a selection past the edge of an editable CodeView collapses it, then stops it growingOpenbug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pierrecomputer/pierre#1189 ·
Maintainers usually reply within 1 day
-
Bug: WebKit crashes when drag-selecting text that auto-scrolls a diff (gutter-utility re-parented mid-drag)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
pierrecomputer/pierre#1184 · 4 comments ·
Maintainers usually reply within 1 day
All issues in pierrecomputer/pierre
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
wormhole-foundation/wormhole#5062 ·
Maintainers usually reply within 1 day
-
internal os specific
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
frostney/GocciaScript#1688 ·
Maintainers usually reply within 1 day
-
integration:hermes
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
vectorize-io/hindsight#5592 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vercel/streamdown#673 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
apache/rocketmq-dashboard#6712 ·
Maintainers usually reply within 3 days