Skip to content

[diffs] CodeView: Ctrl+F#833

Draft
amadeus wants to merge 187 commits into
mainfrom
amadeus/codeview-find
Draft

[diffs] CodeView: Ctrl+F#833
amadeus wants to merge 187 commits into
mainfrom
amadeus/codeview-find

Conversation

@amadeus

@amadeus amadeus commented Jun 18, 2026

Copy link
Copy Markdown
Member

A WIP vibe coded ctrl+f for CodeView.

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jul 17, 2026 12:23am
pierre-docs-diffshub Ready Ready Preview Jul 17, 2026 12:23am
pierre-docs-trees Ready Ready Preview Jul 17, 2026 12:23am
pierrejs-diff-demo Ready Ready Preview Jul 17, 2026 12:23am

Request Review

amadeus and others added 15 commits June 24, 2026 16:22
* Remove history coalesce

* Fix selction/crate not updated when do "redo" command

* Remove visualColumns.ts

* Move editor ts files

* Refactor textarea buffer

* Rename `EditSnippet` type to `TextareaSnapshot`

* Remove `Editor` component, introduce the `Editor` class for `File` component

* Update demo

* Update editor constants to set text and background color to transparent

* Rewrite rerender logic

* Format

* Remove dead code

* Fix caret postion on empty line

* Improve `renderSelectionRange` performance by using cached DOM elements

* Support range selection in textarea

* Improve rerender performance

* Use piece table data sturcture for the text document

* refactor

* Add public `setSelection` method for the `Editor` class

* Add `FileContentsWithLineOffsets` interface and update related components to support line offsets and line count. Refactor file handling to utilize computed line offsets for rendering and iteration.

* Add `updateRenderCacheAt` method to `FileRenderer` and `File` classes for improved rendering. Refactor theme handling in `Editor` to utilize a dedicated method for color map retrieval.

* Refactor file iteration logic by removing `iterateOverFile` utility and replacing it with direct loops in `VirtualizedFile` and `FileRenderer` components. Update line offset computation to exclude trailing newlines in multi-line files while maintaining correct line counts. Enhance tests to validate line counting behavior.

* Remove EOF field

* Remove text length fields from HistoryEntry and related test cases in EditHistory

* Rename class `EditHistory` to `EditStack`

* Refactor EditStack and PieceTable to use a unified text slice interface.

* Refactor PieceTable and TextDocument to improve line offset handling and remove unnecessary EOL trimming logic.

* Refactor `Editor` to utilize new dirty line resolution logic, enhancing performance and accuracy in line tracking.

* Fix multi-cursor textarea sync

* Refactor Editor rendering logic for improved performance and reduce direct DOM manipulation.

* Add grammer cache

* Enhance line position caching in Editor for improved performance and accuracy.

* Refactor indentation handling in Editor and remove unused utility function for improved clarity and performance.

* Fix testing types

* Improve performance of the `getCharacterX` method

* Improve caching mechanism for enhanced performance.

* Add maxEntries feature to EditStack for managing undo history size

* Refactor

* Enhance PieceTable and TextDocument to trim line endings in getLineText method, improving text handling consistency. Update related tests for accuracy.

* Refactor

* Add `BackgroundTokenzier` class

* Improve performance

* Fix hightlight bug

* Add `--diffs-bg-caret` css property

* Fix input

* Fix selection range rendering

* Fix prebuildStateStackCache funciton

* Update `TOKENIZE_MAX_LINE_LENGTH` to 10,000

* Add `DiffsEditor` interface

* Fix `lineAnnotations` argument on `triggerEdit` invoke

* Refactor editor edit method to accept onChange callback directly and update demo to log file changes

* Clean up

* typo

* Refactor BackgroundTokenizer to use message-based scheduling.

* Refactor editor focus handling by removing redundant event listeners and updating CSS selectors for caret visibility.

* Refactor

* Fix `toTextareaSelectionDirection` function

* Refactor

* Update `DiffsEditor` types

* Add line annotation handling

* Add documentation for `hasVisibleLineAnnotation` function.

* Get rid of enum

* Clean up

* Refactor

* Update editor CSS

* Support text wrap

* Clean up

* Fix line y/wrap cache

* Fix line cache

* Copies leading indentation onto the new line after Enter

* Focus textare after undo/redo

* Move multi-selection functions to editorSelection module

* Add support for handling leading indentation deletion in applyTextChangeToSelections

* Fix selection glitch bug

* Add extendSelection command

* Fix `focusTextare` function

* Fix `resolveTextareaChange` function

* Remove unnecessary target check in mouseup event listener in Editor class

* Fix textarea selction direction

* Fix selection bg color for safair

* Clean up

* Fix shift select

* Refactor

* Refactor

* Fix shift select delay

* Coalesce edit stack entries for simple typing or backspace operations.

* Add Support forward-delete coalescing for edit history

* docs: add docs for editStack module

* Refctor

* Fix 'documentStart' and 'documentEnd' commands

* Rewrite selection handle logic

* Fix shouldCoalesceEditStackEntry function

* Update demo

* Add `removeEditor` for File component

* Add react api

* Clean up

* Update demo app

* Refactor useFileInstance to remove redundant editor cleanup logic

* Fix `computeLineOffsets` function

* typo

* Update editor style

* Fix `getOrCreateLineOffSets` method

* Refactor line count and annotation handling in File component; remove hasVisibleLineAnnotation utility

* Fix lines deletion crocss virtul viewport

* Remove `normalizeSelectionsForDocument` function

* Fix `edit` function

* Add editor sub-module

* Use `contenteditable` model

* Fix line wrap

* Fix wrap line

* Fix selection on mobile

* Update editor style

* Fix resize handling

* Add editor overlay layer

* Cleanup

* Add `DiffsEditableComponent` types

* Fix `VirtualizedFile` component

* Update `DiffsEditableComponent` type

* Add editor demo

* Fix slection rendering

* Update editor demo app

* Fix VirualizedFile component

* Update editor demo app

* Fix some selection bugs

* Update demo app

* Refactor findNextNonOverlappingSubstring method into PieceTable and TextDocument

* Refactor

* feat: Implement line jump

* Fix selection rendering when scrolling

* Improve tokenzier performance

* feat: simple search pannel

* Update editor demo app

* Fix jump

* Update search UI

* Add lag radar

* Fix virtualizer

* Fix render range after typing

* Fix editor tokenzier cache

* Fix search input focus

* Update log rader position

* Improve piece table performance

* Refactor

* Add lag radar

* Fix line count for empty documents

* Fix offscreen lines flush

* Introduce gutter width tracking

* refactor

* Refactor

* fix import

* Add 'expandSelectionDocStart' and 'expandSelectionDocEnd' commands

* Fix buffer height

* Add matches text for the search pancel

* Disable preious/next icon when no matches

* Update style.css

* feat: Support `quiteEdit` action

* Update edtior demo app

* Refactor

* Update demo app

* Update demo app

* Fix girdRow when render quick edit UI

* Move testing files

* Clean up

* Add searchPanel.ts

* Fix expandCollapsedSelectionToWord to match when the cursor is immediately touching one of the word's boundaries

* clean up

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix typo

* Clean up searchPanel and quickEdit when swith file

* Rebase to beta-1.2

* Fix selection after clean up quick edit widget

* Fix virtual buffer

* Fix `updateWindowSelection` method of Editor class

* Fix render range when typing new line at the end of the file

* Fix buffer when adding large lines

* [editor] Support 'deleteHardLineForward' input

* Add `insertTranspose` input

* Move `change` handler to options

* Update css

* Merge beta-1.2 changes

* Fix emply line rendering

* Add search settings UI

* Merge branch 'main' into editor

* Support FileDiff component

* Update `DiffsEditableComponent` interface

* Fix `getSelectionAnchor` function

* Fix text measurement for emoji

* Increase delay for diff rendering in FileDiff component

* Update types

* Add unit testings for text measue functions

* Clean up dirty render cache

* Fix `lineAnnotations` re-rendering

* Disable gutter utility when editing

* Add global css

* Fix scrollToLine method

* Refactor selection handling in Editor class to initialize selections properly and streamline rendering logic

* Fix diffs components

* Allow to create selection from gutter interaction

* Fix focus

* Fix browser compatibility

* Support dual themes

* Fix selection bugs

* refactor

* Add `Metrics` class

* Clean up

* Fix wrap selection rendering on safari

* Add `QuickEditContext` types

* Fix caret scroll margin when search panel is on

* Refactor search panel widget

* Fix selection position

* Update react components

* Update search panel CSS

* Fix quick edit

* Add editor docs

* Fix react hooks for editor

* Update editor demo component

* Update Quick Edit docs

* Update `diffStyle` and `expandUnchanged` options when editing

* demo: remove editor route

* Update docs

* Update docs

* Update examples

* Reset selection when 'Esc' key pressed

* Fix selection focus

* Add 'enable edit' shortcut('e')

* Handle the arrow key events to scroll to the cursor position manually

* Merge of overlapping selections

* Handle cursor moving events

* Fix scroll margin top

* Add debug logging option to Editor class

* Fix selection bugs

* Fix selection renering for unified `FileDiff`

* Reset ignore selection change flag on mouse up event

* Clean up

* fix bun.lock

* Add editor theme style

* Refactor

* Fix react types

* Fix last line index calculation

* Update condition for marking DOM dirty in VirtualizedFile component

* Throw if someone is trying to edit with no editor instance

* Update `mergeFileDiffOptions` function

* `lineOffsets` -> `lines`

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…d for the `DiffsEditor` (#766)

* feat(editor): add pause and resume functionality for background tokenization

* pref(editor): Introduce `postponeBackgroundTokenizeToNextFrame` method for the `DiffsEditor`

* fix

* Add debug option for the tokenzier

* Update types

* Refactor

* typo

* Reduce requestAnimationFrame calls
* chore: empty commit for beta branch

* Homepage FileDiff editor demo

* Style kbd elements, add beta badge to docs content, redo table for keyboards, few edits

* docs(editor): add MultiFileDiff React example

Document editing with MultiFileDiff alongside File and FileDiff in the React integration tabs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(editor): use parseDiffFromFile in FileDiff React example

Align the editor FileDiff tab with the pre-parsed fileDiff prop API.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Update editor react examples

* docs(editor): document worker pool usage with useTokenTransformer

Add a Worker Pool section with tabbed vanilla/React examples, and enable
useTokenTransformer on the docs site worker pool so editing works off-thread.

Co-authored-by: Cursor <cursoragent@cursor.com>

* format

* Remove toolbar, put reset into header metadata

* add link

* little copy editing

* Update homepage example to include file and diff

* redo reset

---------

Co-authored-by: Amadeus Demarzi <amadeusdemarzi@gmail.com>
Co-authored-by: Je Xia <i@jex.me>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Rounded selection boundaries
* Search panel refactor/redesign
* Introduce `postponeBackgroundTokenizeToNextFrame` method for the `DiffsEditor`
mdo and others added 23 commits July 14, 2026 13:36
fix issue with selection action, add another selection action for edges
* [diffs/edit] Add legacy-editor test suites harvested from monaco and CodeMirror

Ports behavioral edge-case scenarios from microsoft/vscode (MIT) and
CodeMirror 6 (MIT) test suites into two new bun:test suites under
packages/diffs/test/. 139 tests, including 22 test.failing entries that
encode real bugs found during the port (frozen EditStack entries vs
non-history edits, undo coalescing, surrogate-pair edit boundaries,
CRLF line metadata, and others). Test-only change; fixes land separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Add atom-legacy-tests suite

Third legacy-editor harvest, from atom/text-buffer and atom/superstring
(both MIT): 56 tests covering search/replace semantics (regex capture
expansion, zero-width-match termination, replace-past-own-output,
anchored patterns on CRLF), selection remapping under partial-overlap
replacements, soft-wrap boundary behavior, history invariant fuzzing,
and malformed-position handling. Includes 8 test.failing entries
encoding newly found bugs, the worst being: an edit with a NaN position
component silently replaces the entire document, and soft-wrap vertical
caret motion can land inside a surrogate pair.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Guard ICU-dependent word-segmentation pins with skipIf

Intl.Segmenter's isWordLike classification varies across ICU builds
(underscore joining, bare-digit and Han word-ness differ between
engines/platforms). Two segmenter-side expansion pins now probe the
runtime's segmentation of their own fixture and skip visibly on
divergent ICUs instead of failing. Both tests still execute on our dev
and CI environments, which agree with the pinned segmentation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Extend ICU skipIf guards to all segmenter-side CJK pins

Completes the previous commit: the Chinese, Japanese, and Latin-Katakana
double-click expansion pins depend on the same ICU-variable isWordLike
classification (dictionary-based CJK segmentation is the most
engine-dependent of all), so they get the same runtime probe treatment
via a shared wordLikeSegments helper. Delete-word tests are untouched —
the regex classifier is deterministic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Consolidate editor-derived tests into the main suite

Per team feedback: the three editor-named test directories are gone and
all 195 tests now live in the existing per-domain files
(editorPieceTable, editorTextDocument, editorApplyEdits, editorEditStack,
editorSelection, editorSearchPanel, editorWrapCaretPosition).
Migration was audited name-by-name before deletion: every test present
exactly once, all 30 test.failing known-bug pins and 5 ICU skipIf guards
preserved. Comments no longer reference other editors; the conventions,
known-bug inventory, coverage-gap additions, and a single provenance
note moved into test/README.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Pin block-indent blank-line bug as test.failing

resolveIndentEdits inserts the indent unit at column 0 of every line a
multi-line selection touches, including empty and whitespace-only lines,
injecting trailing whitespace on lines the user never typed on. Outdent
round-trips it away, bounding the damage to the indented state. Brings
the pinned known-bug count to 31.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Drop the wiped-region graceful-undo pin

We don't model programmatic edits as a class distinct from local edits,
so the scenario's premise (a dead history entry after an untracked edit
replaced its region) doesn't match the intended design. The remaining
five history-across-untracked-edits pins stand; pinned known-bug count
returns to 30.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [diffs/edit] Reframe history-mixing pins around programmatic==local equivalence

Design decision: edits applied with updateHistory=false are not a
semantic class distinct from local edits — a mixed sequence must behave
exactly like the same sequence applied all-tracked. The old pins
asserted rebasing semantics (untracked edits surviving undo); all are
flipped to equivalence assertions whose expected values mirror an
all-tracked reference run: undo-to-exhaustion restores the original
text, redo-to-exhaustion the final text. The wiped-region test returns
under the new model, and the coalescing-across-an-untracked-edit pin
flipped from passing to failing because its outcome also deviates from
the all-tracked timeline. Cluster: 7 failing pins; suite total 32.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* sick

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…ion (#986)

Math.min/max pass NaN straight through and fractional indexes break the
integer-keyed line-offset lookup, so a NaN (or fractional) line/character
resolved to a NaN offset and the degenerate edit range swallowed the
entire document — an insert with one malformed component silently erased
everything else. normalizePosition now sanitizes before clamping: NaN
and -Infinity act as 0, fractions floor, +Infinity clamps to the max.
Every position-taking API funnels through it (offsetAt, resolveEdit),
so all edit paths are covered. Flips the two malformed-position pins to
permanent regression tests with exact expectations; pinned known-bug
count drops to 30.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Refactor edit resolution logic to improve surrogate pair handling

* fix codex
* [diffs/edit] Fix soft-wrap vertical caret motion

* fix
* Rename popup to popover to be more consistent

* fix codex

* fix e2e testing

---------

Co-authored-by: Je Xia <i@jex.me>
* fix typo

* fix editStack coalescing bugs.
* fix(diffs): Keep editor active line separate from selected lines

Moving the caret in edit mode reused the selected-lines state, which could
replace an existing line selection and disturb its callbacks or gutter
utility.

Track the editor active line independently and derive one visual highlight
where selected lines take precedence. Preserve both states across diff row
refreshes so each retains its latest value.

* fix(diffs): Preserve interactions in edit mode

Entering Edit mode with line selection, gutter utilities, or hover
highlighting enabled currently turns those interactions off and clears
selected lines.

Preserve the configured interaction options while enabling only the
token transformer required by the editor. Keep editor active-line
styling separate from selected-line styling, protect gutter utility
gestures from editor selection handlers, and exercise the behavior
across playground views.

* docs(diffs): Remove obsolete editor option overrides

Update editor documentation and live examples to stop disabling gutter
utilities, line selection, and hover highlighting in edit mode.

Keep useTokenTransformer enabled in prerendered examples because the
editor still requires it, and refresh the generated homepage fixture.

* fix(diffs): Keep text and line selections independent

Dragging a gutter utility now updates the line range and selection
lifecycle even when ordinary line selection is disabled. Ordinary gutter
drags remain disabled, and callbacks retain the completed gesture range
when utility code changes the current selection.

Preserve editor text selections during gutter-owned gestures and render
the cursor line independently from selected diff lines. Retry incomplete
renders, avoid rewriting unchanged ranges, and keep both states visible
across supported themes.

* docs(diffs): Document gutter utility selection callbacks

Clarify that gutter utility gestures emit selection lifecycle callbacks
even when ordinary line selection is disabled.

* fix(docs): Respect editor active lines in Agent UI

Added and deleted gutter numbers kept their base colors on the editor
cursor line because the Agent UI override excluded the obsolete
`data-active` attribute.

Exclude `data-editor-active-line` instead and update the generated demo
snapshot so the editor active-line styling can apply.

* Fix playground with new selection states

* fix(diffs): Compose editor active lines with diff states

Select a line in edit mode and move the cursor onto it: the theme current-line background can obscure the selection and addition or deletion color.

Resolve decoration, diff, selection, editor active, and hover colors as ordered layers. Derive active emphasis from the resolved semantic color, retain theme borders as a fallback cue, and prevent gutter numbers from receiving the selection mix twice.

* fix(diffs): Flush line state after virtualized rerenders

Edit inside a collapsed diff region, then move the caret or update the
line selection: virtualized views can keep showing the previous line
state after rebuilding their rows.

Flush deferred selected and active-line writes after virtualized
managers bind to the rebuilt DOM, and cover the region-changing render
path.
I need to more deeply review this... it's probably a fuck ton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants