Repository navigation
[diffs] Misc Polish Feedback Items - #1294
Merged
Merged
Conversation
Give CodeView a partial diff with a cacheKey, then pass a new object for the same diff with the same cacheKey and a bumped version. Expand a collapsed region in that file: the full files load, but the context never appears, and every later expand fails the same way. The loaded files wait for the next layout pass, which applied them only when CodeView passed the exact object the load started with. The instance keeps its first object when cacheKeys match, so a re-created diff never matched again. Compare with areDiffTargetsEqual, as the instance does for its own input, and write the loaded contents into the object the host passes now.
Create the worker pool in a Vite dev server with the documented `worker.js?worker&url` recipe, then render a file. The console logs a worker error on every render, such as a language or theme that was never loaded. When that reply arrives first, the file renders without highlighting. The highlighter backends load lazily, and their chunks imported shared code back out of worker.js. Vite dev loads a worker entry under its own URL, so that import ran the entry a second time in the same worker, with a second message listener and none of the state the pool had sent. Move the worker code to workerHandlers.ts and leave worker.ts as one call to registerWorkerHandlers. Build both as entries, which keeps the shared code out of worker.js so no chunk imports it.
Open find in a CodeView, then close it with Escape or its close button. Focus drops to the page body, so the next Cmd+F or arrow key goes nowhere until you click back into the diff. Closing removed the panel while its input still had focus, and nothing took the focus over. closeSearch now checks whether the panel holds focus before removing it. If it does, focus moves to the CodeView root, and then to the editor the panel was searching when there is one. A panel that did not have focus leaves focus where it was. The panel now tells its host it is closing before it removes itself. Its close button used to remove it first, which left the host no way to see that it had held focus.
Select some text in a line of a file or diff, then press Cmd/Ctrl+F. The find box now opens with that text as the query and its matches found, instead of opening empty. Until now only a focused edit-mode item filled the box, from the editor's own selection. When find opens across every item, CodeView now reads the browser's selection through each rendered item's shadow root and uses it when all of it sits in one code line. A selection that spans lines, or sits outside the code, still opens the box empty, and an open panel keeps its query.
Open find in a narrow CodeView and search for text that sits on the top line. The find panel floats over that corner, so the current match stays hidden under it. Stepping to a match further away centers it in the whole viewport, as if the panel and the sticky header were not there. Navigation now works from where the match is drawn. A match counts as visible when it is inside the viewport, below the sticky header, and not under the panel. Anything else is centered in the space below the taller of the two. A match that is not rendered yet has no position to read, so the scroll starts from its line and switches to the measured position once the row exists. Wrapped lines no longer matter, since the target is the match and not its line. The panel was also mounted after a renderCodeViewHeader host, which left it below the header until the header scrolled away. It now mounts ahead of it and stays at the top of the scroll view. Search highlights are painted earlier in the render pass, once the rows are in place, so a find scroll can measure its match before the scroll is resolved for that frame.
Step through find results in a CodeView. The view now jumps straight to each match. Before, it glided there whenever the match was within a few screens, which is not how find behaves in most editors and browsers. The default for searchOptions.scrollBehavior changes from 'smooth-auto' to 'instant'. Hosts that want the animation set 'smooth' or 'smooth-auto' themselves.
In a split diff with long lines, step through find results twice in quick succession, such as with a held Enter key. The current match can end up scrolled out of view sideways, and nothing brings it back. Stepping to a match scrolled its code column sideways straight from the key handler. The two split columns copy each other's scroll position on the next frame, so a second step inside the same frame was overwritten by the first step's late copy. The sideways scroll now runs only in the frame paint, once per frame, as it did before the find panel work. Navigation still paints the highlight ranges right away to read where the match is, without scrolling.
CodeView find skipped collapsed items and, in unscoped search, the unchanged lines hidden between hunks. Both are now searched. Landing on a hidden match expands what hides it: the region through revealLine, the file through updateItem with collapsed: false and a bumped version. A hidden match counts as on screen when its file header or separator row is, so find still starts from the first match in view. isLineRenderable is renamed isLineInCollapsedContext, with the sense flipped, and it and revealLine take a side. In CodeView an expansion is applied at the next layout pass; until then VirtualizedFileDiff keeps the expansion state as it will be, so a just-revealed line has a position to scroll to.
Find opens a collapsed item when it lands on a match inside it. An owner that keeps its own item list was never told, so its next list still said collapsed at the old version and the item closed again. onItemCollapsedChange(item, nextItem) is called after CodeView itself changes an item's collapsed state, with the item before the change and the one CodeView has already applied. It is not called for changes the owner makes, and it cannot veto. Find is the only caller.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Editor.setSelections([]) with markers or find matches present scrolled back to the old caret and focused the editor. The selection update only dropped the stored selection when nothing else was drawn in the overlay; otherwise it redrew the markers and matches and left the old selection in state, and the scroll that follows found it. An empty list now always clears the selection. Selecting a deleted line had the same stale selection and is fixed by the same change.
Header counts were written raw and the i18n store turned every number into text with String(), so the UI showed "+12345", "12345 unmodified lines" and "1 of 10000". The store now builds an Intl.NumberFormat for its locale. `#` in a plural block and numeric arguments go through it, and i18n.formatNumber covers counts that are not part of a message, which the diff header uses. The header's cached HTML records the i18n version it was written under, so a header picks up a locale change the next time it renders, including one that happened while it was scrolled out of a CodeView. FileDiff and File no longer subscribe to theme and message changes in their constructors. They start listening when they first get a container and stop in cleanUp. CodeView creates an instance per item, and a full-list setItems left every new one listening whether or not it was rendered: 300 new items meant 300 callbacks per change.
A collapsed item shows only its header, but it got that header by running the full row pipeline with an empty render range. That asked for a highlight of the whole diff or file: a worker pool task per collapsed item, or a main-thread highlight without a pool. Both renderers now have renderCollapsed, which returns the header and the theme's styles, builds no rows and requests no highlight. When no highlighter has the theme yet it loads one with the text language only and asks for another render. A collapsed item takes a new diff or file at once. The renderer keeps the previous input's rows on screen until the new one is highlighted, which for a collapsed item left the old name and counts in the header until a highlight answer arrived. renderCollapsed also drops rows cached for another input, and hydration state that only describes prerendered DOM, since collapsing removes that DOM. EMPTY_RENDER_RANGE has no remaining use and is removed.
amadeus
marked this pull request as ready for review
November 14, 2026 08:10
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A find-only panel had an extra 6px before the find input. The hidden replace toggle still had its own grid column, and that column's gap remained. With the toggle shown, the chevron sat off center: the widget's padding on one side and the wider column gap on the other. The grid now carries data-can-replace when the panel can replace, and only then has a toggle column. The toggle's margin is the difference between the widget's padding and the column gap, so it has the same space on both sides in the wide and narrow layouts. One helper sets the grid's mode, data-can-replace, and the toggle's hidden and aria-expanded, in place of three copies of that code.
amadeus
added a commit
that referenced
this pull request
Nov 14, 2026
* fix(diffs): keep expand working after a diff is re-created Give CodeView a partial diff with a cacheKey, then pass a new object for the same diff with the same cacheKey and a bumped version. Expand a collapsed region in that file: the full files load, but the context never appears, and every later expand fails the same way. The loaded files wait for the next layout pass, which applied them only when CodeView passed the exact object the load started with. The instance keeps its first object when cacheKeys match, so a re-created diff never matched again. Compare with areDiffTargetsEqual, as the instance does for its own input, and write the loaded contents into the object the host passes now. * fix(diffs): stop Vite dev from running the worker entry twice Create the worker pool in a Vite dev server with the documented `worker.js?worker&url` recipe, then render a file. The console logs a worker error on every render, such as a language or theme that was never loaded. When that reply arrives first, the file renders without highlighting. The highlighter backends load lazily, and their chunks imported shared code back out of worker.js. Vite dev loads a worker entry under its own URL, so that import ran the entry a second time in the same worker, with a second message listener and none of the state the pool had sent. Move the worker code to workerHandlers.ts and leave worker.ts as one call to registerWorkerHandlers. Build both as entries, which keeps the shared code out of worker.js so no chunk imports it. * fix(diffs): keep focus in CodeView when the find panel closes Open find in a CodeView, then close it with Escape or its close button. Focus drops to the page body, so the next Cmd+F or arrow key goes nowhere until you click back into the diff. Closing removed the panel while its input still had focus, and nothing took the focus over. closeSearch now checks whether the panel holds focus before removing it. If it does, focus moves to the CodeView root, and then to the editor the panel was searching when there is one. A panel that did not have focus leaves focus where it was. The panel now tells its host it is closing before it removes itself. Its close button used to remove it first, which left the host no way to see that it had held focus. * feat(diffs): open CodeView find on the selected text Select some text in a line of a file or diff, then press Cmd/Ctrl+F. The find box now opens with that text as the query and its matches found, instead of opening empty. Until now only a focused edit-mode item filled the box, from the editor's own selection. When find opens across every item, CodeView now reads the browser's selection through each rendered item's shadow root and uses it when all of it sits in one code line. A selection that spans lines, or sits outside the code, still opens the box empty, and an open panel keeps its query. * fix(diffs): keep find matches clear of the find panel Open find in a narrow CodeView and search for text that sits on the top line. The find panel floats over that corner, so the current match stays hidden under it. Stepping to a match further away centers it in the whole viewport, as if the panel and the sticky header were not there. Navigation now works from where the match is drawn. A match counts as visible when it is inside the viewport, below the sticky header, and not under the panel. Anything else is centered in the space below the taller of the two. A match that is not rendered yet has no position to read, so the scroll starts from its line and switches to the measured position once the row exists. Wrapped lines no longer matter, since the target is the match and not its line. The panel was also mounted after a renderCodeViewHeader host, which left it below the header until the header scrolled away. It now mounts ahead of it and stays at the top of the scroll view. Search highlights are painted earlier in the render pass, once the rows are in place, so a find scroll can measure its match before the scroll is resolved for that frame. * feat(diffs): scroll to CodeView find matches instantly by default Step through find results in a CodeView. The view now jumps straight to each match. Before, it glided there whenever the match was within a few screens, which is not how find behaves in most editors and browsers. The default for searchOptions.scrollBehavior changes from 'smooth-auto' to 'instant'. Hosts that want the animation set 'smooth' or 'smooth-auto' themselves. * fix(diffs): keep the find match in view after two quick steps In a split diff with long lines, step through find results twice in quick succession, such as with a held Enter key. The current match can end up scrolled out of view sideways, and nothing brings it back. Stepping to a match scrolled its code column sideways straight from the key handler. The two split columns copy each other's scroll position on the next frame, so a second step inside the same frame was overwritten by the first step's late copy. The sideways scroll now runs only in the frame paint, once per frame, as it did before the find panel work. Navigation still paints the highlight ranges right away to read where the match is, without scrolling. * feat(diffs): find matches in collapsed files and collapsed context CodeView find skipped collapsed items and, in unscoped search, the unchanged lines hidden between hunks. Both are now searched. Landing on a hidden match expands what hides it: the region through revealLine, the file through updateItem with collapsed: false and a bumped version. A hidden match counts as on screen when its file header or separator row is, so find still starts from the first match in view. isLineRenderable is renamed isLineInCollapsedContext, with the sense flipped, and it and revealLine take a side. In CodeView an expansion is applied at the next layout pass; until then VirtualizedFileDiff keeps the expansion state as it will be, so a just-revealed line has a position to scroll to. * feat(diffs): add onItemCollapsedChange to CodeView Find opens a collapsed item when it lands on a match inside it. An owner that keeps its own item list was never told, so its next list still said collapsed at the old version and the item closed again. onItemCollapsedChange(item, nextItem) is called after CodeView itself changes an item's collapsed state, with the item before the change and the one CodeView has already applied. It is not called for changes the owner makes, and it cannot veto. Find is the only caller. * fix(diffs): clear the editor selection while markers or matches show Editor.setSelections([]) with markers or find matches present scrolled back to the old caret and focused the editor. The selection update only dropped the stored selection when nothing else was drawn in the overlay; otherwise it redrew the markers and matches and left the old selection in state, and the scroll that follows found it. An empty list now always clears the selection. Selecting a deleted line had the same stale selection and is fixed by the same change. * feat(diffs): group digits in counts for the i18n locale Header counts were written raw and the i18n store turned every number into text with String(), so the UI showed "+12345", "12345 unmodified lines" and "1 of 10000". The store now builds an Intl.NumberFormat for its locale. `#` in a plural block and numeric arguments go through it, and i18n.formatNumber covers counts that are not part of a message, which the diff header uses. The header's cached HTML records the i18n version it was written under, so a header picks up a locale change the next time it renders, including one that happened while it was scrolled out of a CodeView. FileDiff and File no longer subscribe to theme and message changes in their constructors. They start listening when they first get a container and stop in cleanUp. CodeView creates an instance per item, and a full-list setItems left every new one listening whether or not it was rendered: 300 new items meant 300 callbacks per change. * fix(diffs): stop highlighting collapsed items A collapsed item shows only its header, but it got that header by running the full row pipeline with an empty render range. That asked for a highlight of the whole diff or file: a worker pool task per collapsed item, or a main-thread highlight without a pool. Both renderers now have renderCollapsed, which returns the header and the theme's styles, builds no rows and requests no highlight. When no highlighter has the theme yet it loads one with the text language only and asks for another render. A collapsed item takes a new diff or file at once. The renderer keeps the previous input's rows on screen until the new one is highlighted, which for a collapsed item left the old name and counts in the header until a highlight answer arrived. renderCollapsed also drops rows cached for another input, and hydration state that only describes prerendered DOM, since collapsing removes that DOM. EMPTY_RENDER_RANGE has no remaining use and is removed. * fix(diffs): tidy the find panel's leading spacing A find-only panel had an extra 6px before the find input. The hidden replace toggle still had its own grid column, and that column's gap remained. With the toggle shown, the chevron sat off center: the widget's padding on one side and the wider column gap on the other. The grid now carries data-can-replace when the panel can replace, and only then has a toggle column. The toggle's margin is the difference between the widget's padding and the column gap, so it has the same space on both sides in the wide and narrow layouts. One helper sets the grid's mode, data-can-replace, and the toggle's hidden and aria-expanded, in place of three copies of that code.
amadeus
added a commit
that referenced
this pull request
Nov 21, 2026
* fix(diffs): keep expand working after a diff is re-created Give CodeView a partial diff with a cacheKey, then pass a new object for the same diff with the same cacheKey and a bumped version. Expand a collapsed region in that file: the full files load, but the context never appears, and every later expand fails the same way. The loaded files wait for the next layout pass, which applied them only when CodeView passed the exact object the load started with. The instance keeps its first object when cacheKeys match, so a re-created diff never matched again. Compare with areDiffTargetsEqual, as the instance does for its own input, and write the loaded contents into the object the host passes now. * fix(diffs): stop Vite dev from running the worker entry twice Create the worker pool in a Vite dev server with the documented `worker.js?worker&url` recipe, then render a file. The console logs a worker error on every render, such as a language or theme that was never loaded. When that reply arrives first, the file renders without highlighting. The highlighter backends load lazily, and their chunks imported shared code back out of worker.js. Vite dev loads a worker entry under its own URL, so that import ran the entry a second time in the same worker, with a second message listener and none of the state the pool had sent. Move the worker code to workerHandlers.ts and leave worker.ts as one call to registerWorkerHandlers. Build both as entries, which keeps the shared code out of worker.js so no chunk imports it. * fix(diffs): keep focus in CodeView when the find panel closes Open find in a CodeView, then close it with Escape or its close button. Focus drops to the page body, so the next Cmd+F or arrow key goes nowhere until you click back into the diff. Closing removed the panel while its input still had focus, and nothing took the focus over. closeSearch now checks whether the panel holds focus before removing it. If it does, focus moves to the CodeView root, and then to the editor the panel was searching when there is one. A panel that did not have focus leaves focus where it was. The panel now tells its host it is closing before it removes itself. Its close button used to remove it first, which left the host no way to see that it had held focus. * feat(diffs): open CodeView find on the selected text Select some text in a line of a file or diff, then press Cmd/Ctrl+F. The find box now opens with that text as the query and its matches found, instead of opening empty. Until now only a focused edit-mode item filled the box, from the editor's own selection. When find opens across every item, CodeView now reads the browser's selection through each rendered item's shadow root and uses it when all of it sits in one code line. A selection that spans lines, or sits outside the code, still opens the box empty, and an open panel keeps its query. * fix(diffs): keep find matches clear of the find panel Open find in a narrow CodeView and search for text that sits on the top line. The find panel floats over that corner, so the current match stays hidden under it. Stepping to a match further away centers it in the whole viewport, as if the panel and the sticky header were not there. Navigation now works from where the match is drawn. A match counts as visible when it is inside the viewport, below the sticky header, and not under the panel. Anything else is centered in the space below the taller of the two. A match that is not rendered yet has no position to read, so the scroll starts from its line and switches to the measured position once the row exists. Wrapped lines no longer matter, since the target is the match and not its line. The panel was also mounted after a renderCodeViewHeader host, which left it below the header until the header scrolled away. It now mounts ahead of it and stays at the top of the scroll view. Search highlights are painted earlier in the render pass, once the rows are in place, so a find scroll can measure its match before the scroll is resolved for that frame. * feat(diffs): scroll to CodeView find matches instantly by default Step through find results in a CodeView. The view now jumps straight to each match. Before, it glided there whenever the match was within a few screens, which is not how find behaves in most editors and browsers. The default for searchOptions.scrollBehavior changes from 'smooth-auto' to 'instant'. Hosts that want the animation set 'smooth' or 'smooth-auto' themselves. * fix(diffs): keep the find match in view after two quick steps In a split diff with long lines, step through find results twice in quick succession, such as with a held Enter key. The current match can end up scrolled out of view sideways, and nothing brings it back. Stepping to a match scrolled its code column sideways straight from the key handler. The two split columns copy each other's scroll position on the next frame, so a second step inside the same frame was overwritten by the first step's late copy. The sideways scroll now runs only in the frame paint, once per frame, as it did before the find panel work. Navigation still paints the highlight ranges right away to read where the match is, without scrolling. * feat(diffs): find matches in collapsed files and collapsed context CodeView find skipped collapsed items and, in unscoped search, the unchanged lines hidden between hunks. Both are now searched. Landing on a hidden match expands what hides it: the region through revealLine, the file through updateItem with collapsed: false and a bumped version. A hidden match counts as on screen when its file header or separator row is, so find still starts from the first match in view. isLineRenderable is renamed isLineInCollapsedContext, with the sense flipped, and it and revealLine take a side. In CodeView an expansion is applied at the next layout pass; until then VirtualizedFileDiff keeps the expansion state as it will be, so a just-revealed line has a position to scroll to. * feat(diffs): add onItemCollapsedChange to CodeView Find opens a collapsed item when it lands on a match inside it. An owner that keeps its own item list was never told, so its next list still said collapsed at the old version and the item closed again. onItemCollapsedChange(item, nextItem) is called after CodeView itself changes an item's collapsed state, with the item before the change and the one CodeView has already applied. It is not called for changes the owner makes, and it cannot veto. Find is the only caller. * fix(diffs): clear the editor selection while markers or matches show Editor.setSelections([]) with markers or find matches present scrolled back to the old caret and focused the editor. The selection update only dropped the stored selection when nothing else was drawn in the overlay; otherwise it redrew the markers and matches and left the old selection in state, and the scroll that follows found it. An empty list now always clears the selection. Selecting a deleted line had the same stale selection and is fixed by the same change. * feat(diffs): group digits in counts for the i18n locale Header counts were written raw and the i18n store turned every number into text with String(), so the UI showed "+12345", "12345 unmodified lines" and "1 of 10000". The store now builds an Intl.NumberFormat for its locale. `#` in a plural block and numeric arguments go through it, and i18n.formatNumber covers counts that are not part of a message, which the diff header uses. The header's cached HTML records the i18n version it was written under, so a header picks up a locale change the next time it renders, including one that happened while it was scrolled out of a CodeView. FileDiff and File no longer subscribe to theme and message changes in their constructors. They start listening when they first get a container and stop in cleanUp. CodeView creates an instance per item, and a full-list setItems left every new one listening whether or not it was rendered: 300 new items meant 300 callbacks per change. * fix(diffs): stop highlighting collapsed items A collapsed item shows only its header, but it got that header by running the full row pipeline with an empty render range. That asked for a highlight of the whole diff or file: a worker pool task per collapsed item, or a main-thread highlight without a pool. Both renderers now have renderCollapsed, which returns the header and the theme's styles, builds no rows and requests no highlight. When no highlighter has the theme yet it loads one with the text language only and asks for another render. A collapsed item takes a new diff or file at once. The renderer keeps the previous input's rows on screen until the new one is highlighted, which for a collapsed item left the old name and counts in the header until a highlight answer arrived. renderCollapsed also drops rows cached for another input, and hydration state that only describes prerendered DOM, since collapsing removes that DOM. EMPTY_RENDER_RANGE has no remaining use and is removed. * fix(diffs): tidy the find panel's leading spacing A find-only panel had an extra 6px before the find input. The hidden replace toggle still had its own grid column, and that column's gap remained. With the toggle shown, the chevron sat off center: the widget's padding on one side and the wider column gap on the other. The grid now carries data-can-replace when the panel can replace, and only then has a toggle column. The toggle's margin is the difference between the widget's padding and the column gap, so it has the same space on both sides in the wide and narrow layouts. One helper sets the grid's mode, data-can-replace, and the toggle's hidden and aria-expanded, in place of three copies of that code.
amadeus
added a commit
that referenced
this pull request
Nov 22, 2026
* fix(diffs): keep expand working after a diff is re-created Give CodeView a partial diff with a cacheKey, then pass a new object for the same diff with the same cacheKey and a bumped version. Expand a collapsed region in that file: the full files load, but the context never appears, and every later expand fails the same way. The loaded files wait for the next layout pass, which applied them only when CodeView passed the exact object the load started with. The instance keeps its first object when cacheKeys match, so a re-created diff never matched again. Compare with areDiffTargetsEqual, as the instance does for its own input, and write the loaded contents into the object the host passes now. * fix(diffs): stop Vite dev from running the worker entry twice Create the worker pool in a Vite dev server with the documented `worker.js?worker&url` recipe, then render a file. The console logs a worker error on every render, such as a language or theme that was never loaded. When that reply arrives first, the file renders without highlighting. The highlighter backends load lazily, and their chunks imported shared code back out of worker.js. Vite dev loads a worker entry under its own URL, so that import ran the entry a second time in the same worker, with a second message listener and none of the state the pool had sent. Move the worker code to workerHandlers.ts and leave worker.ts as one call to registerWorkerHandlers. Build both as entries, which keeps the shared code out of worker.js so no chunk imports it. * fix(diffs): keep focus in CodeView when the find panel closes Open find in a CodeView, then close it with Escape or its close button. Focus drops to the page body, so the next Cmd+F or arrow key goes nowhere until you click back into the diff. Closing removed the panel while its input still had focus, and nothing took the focus over. closeSearch now checks whether the panel holds focus before removing it. If it does, focus moves to the CodeView root, and then to the editor the panel was searching when there is one. A panel that did not have focus leaves focus where it was. The panel now tells its host it is closing before it removes itself. Its close button used to remove it first, which left the host no way to see that it had held focus. * feat(diffs): open CodeView find on the selected text Select some text in a line of a file or diff, then press Cmd/Ctrl+F. The find box now opens with that text as the query and its matches found, instead of opening empty. Until now only a focused edit-mode item filled the box, from the editor's own selection. When find opens across every item, CodeView now reads the browser's selection through each rendered item's shadow root and uses it when all of it sits in one code line. A selection that spans lines, or sits outside the code, still opens the box empty, and an open panel keeps its query. * fix(diffs): keep find matches clear of the find panel Open find in a narrow CodeView and search for text that sits on the top line. The find panel floats over that corner, so the current match stays hidden under it. Stepping to a match further away centers it in the whole viewport, as if the panel and the sticky header were not there. Navigation now works from where the match is drawn. A match counts as visible when it is inside the viewport, below the sticky header, and not under the panel. Anything else is centered in the space below the taller of the two. A match that is not rendered yet has no position to read, so the scroll starts from its line and switches to the measured position once the row exists. Wrapped lines no longer matter, since the target is the match and not its line. The panel was also mounted after a renderCodeViewHeader host, which left it below the header until the header scrolled away. It now mounts ahead of it and stays at the top of the scroll view. Search highlights are painted earlier in the render pass, once the rows are in place, so a find scroll can measure its match before the scroll is resolved for that frame. * feat(diffs): scroll to CodeView find matches instantly by default Step through find results in a CodeView. The view now jumps straight to each match. Before, it glided there whenever the match was within a few screens, which is not how find behaves in most editors and browsers. The default for searchOptions.scrollBehavior changes from 'smooth-auto' to 'instant'. Hosts that want the animation set 'smooth' or 'smooth-auto' themselves. * fix(diffs): keep the find match in view after two quick steps In a split diff with long lines, step through find results twice in quick succession, such as with a held Enter key. The current match can end up scrolled out of view sideways, and nothing brings it back. Stepping to a match scrolled its code column sideways straight from the key handler. The two split columns copy each other's scroll position on the next frame, so a second step inside the same frame was overwritten by the first step's late copy. The sideways scroll now runs only in the frame paint, once per frame, as it did before the find panel work. Navigation still paints the highlight ranges right away to read where the match is, without scrolling. * feat(diffs): find matches in collapsed files and collapsed context CodeView find skipped collapsed items and, in unscoped search, the unchanged lines hidden between hunks. Both are now searched. Landing on a hidden match expands what hides it: the region through revealLine, the file through updateItem with collapsed: false and a bumped version. A hidden match counts as on screen when its file header or separator row is, so find still starts from the first match in view. isLineRenderable is renamed isLineInCollapsedContext, with the sense flipped, and it and revealLine take a side. In CodeView an expansion is applied at the next layout pass; until then VirtualizedFileDiff keeps the expansion state as it will be, so a just-revealed line has a position to scroll to. * feat(diffs): add onItemCollapsedChange to CodeView Find opens a collapsed item when it lands on a match inside it. An owner that keeps its own item list was never told, so its next list still said collapsed at the old version and the item closed again. onItemCollapsedChange(item, nextItem) is called after CodeView itself changes an item's collapsed state, with the item before the change and the one CodeView has already applied. It is not called for changes the owner makes, and it cannot veto. Find is the only caller. * fix(diffs): clear the editor selection while markers or matches show Editor.setSelections([]) with markers or find matches present scrolled back to the old caret and focused the editor. The selection update only dropped the stored selection when nothing else was drawn in the overlay; otherwise it redrew the markers and matches and left the old selection in state, and the scroll that follows found it. An empty list now always clears the selection. Selecting a deleted line had the same stale selection and is fixed by the same change. * feat(diffs): group digits in counts for the i18n locale Header counts were written raw and the i18n store turned every number into text with String(), so the UI showed "+12345", "12345 unmodified lines" and "1 of 10000". The store now builds an Intl.NumberFormat for its locale. `#` in a plural block and numeric arguments go through it, and i18n.formatNumber covers counts that are not part of a message, which the diff header uses. The header's cached HTML records the i18n version it was written under, so a header picks up a locale change the next time it renders, including one that happened while it was scrolled out of a CodeView. FileDiff and File no longer subscribe to theme and message changes in their constructors. They start listening when they first get a container and stop in cleanUp. CodeView creates an instance per item, and a full-list setItems left every new one listening whether or not it was rendered: 300 new items meant 300 callbacks per change. * fix(diffs): stop highlighting collapsed items A collapsed item shows only its header, but it got that header by running the full row pipeline with an empty render range. That asked for a highlight of the whole diff or file: a worker pool task per collapsed item, or a main-thread highlight without a pool. Both renderers now have renderCollapsed, which returns the header and the theme's styles, builds no rows and requests no highlight. When no highlighter has the theme yet it loads one with the text language only and asks for another render. A collapsed item takes a new diff or file at once. The renderer keeps the previous input's rows on screen until the new one is highlighted, which for a collapsed item left the old name and counts in the header until a highlight answer arrived. renderCollapsed also drops rows cached for another input, and hydration state that only describes prerendered DOM, since collapsing removes that DOM. EMPTY_RENDER_RANGE has no remaining use and is removed. * fix(diffs): tidy the find panel's leading spacing A find-only panel had an extra 6px before the find input. The hidden replace toggle still had its own grid column, and that column's gap remained. With the toggle shown, the chevron sat off center: the widget's padding on one side and the wider column gap on the other. The grid now carries data-can-replace when the panel can replace, and only then has a toggle column. The toggle's margin is the difference between the widget's padding and the column gap, so it has the same space on both sides in the wide and narrow layouts. One helper sets the grid's mode, data-can-replace, and the toggle's hidden and aria-expanded, in place of three copies of that code.
This branch was successfully deployed
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.
Fixes and small features from feedback on
1.7.0-beta.3, mostly around CodeView find.Find
searchOptions.scrollBehaviorstill accepts'smooth'and'smooth-auto'.body.CodeView
onItemCollapsedChange(item, nextItem)option, called after CodeView changes an item'scollapseditself (find opening a collapsed file). An owner that keeps its own items stores the change.Rendering
FileDiffandFilelisten for theme and message changes from their first render untilcleanUp, not from construction. A full-listsetItemsused to leave every new CodeView item listening.Editor
setSelections([])with markers or find matches showing clears the selection. It used to scroll back to the old caret and take focus.i18n
+12,345in headers, "12,345 unmodified lines", "1,000 of 1,234".i18n.formatNumberis new.Build
worker/worker.tsonly registers the handlers, which moved toworker/workerHandlers.ts.API changes
FileDiff.isLineRenderableis nowisLineInCollapsedContext, with the opposite sense. It andrevealLinetake aside.EMPTY_RENDER_RANGEis removed from the constants entry.ExpandedHunksMapis a new exported type.themeSubscribersstat counts rendered instances.Measured
Headless Chromium, the commit before the collapsed-item change against it. A CodeView of 300 collapsed diffs, 300 lines each, scrolled top to bottom: