@@ -21,7 +21,6 @@ import type {
2121 TokenAnnotationMeta ,
2222} from '@plannotator/ui/types' ;
2323import { CommentPopover } from '@plannotator/ui/components/CommentPopover' ;
24- import { storage } from '@plannotator/ui/utils/storage' ;
2524import { usePierreTheme } from '../hooks/usePierreTheme' ;
2625import type { DiffFile } from '../types' ;
2726import { buildFileTree , getVisualFileOrder } from '../utils/buildFileTree' ;
@@ -115,17 +114,11 @@ import {
115114 *
116115 * P7 finished the edges that made CodeView the sole all-files renderer:
117116 *
118- * - Center split dragger: the legacy single-file DiffViewer owns a per-file
119- * split dragger; the legacy all-files view had none. With one CodeView
120- * container we add a single dragger here. The `--split-left` / `--split-right`
121- * CSS variables are set on the CodeView CONTAINER (light DOM) — they inherit
122- * through every item's shadow root, so the existing usePierreTheme grid rule
123- * (`[data-diff-type='split'][data-overflow='scroll']`) resizes every split
124- * file's two columns uniformly. The drag overlay is a single vertical line
125- * pinned to the container at `splitRatio` of its width; because it is
126- * positioned relative to the (non-virtualized) container — not to any
127- * individual item — it is unaffected by virtualization, sticky headers, or
128- * CodeView's 12M-px paged scroll rebasing. Only shown in split + scroll mode.
117+ * - No center split dragger: the legacy all-files view never had one, and a
118+ * single global drag line across every file is noise on files where a
119+ * split is meaningless (new/deleted files). Split columns use Pierre's
120+ * default even 1fr/1fr layout; the single-file DiffViewer keeps its
121+ * per-file dragger.
129122 * - Token code navigation: Cmd/Ctrl-click a token routes through
130123 * `onCodeNavRequest` (parity with the single-file DiffViewer and the legacy
131124 * all-files view), with the `pn-token-nav` affordance (the hover-only
@@ -424,48 +417,11 @@ export const AllFilesCodeView: React.FC<AllFilesCodeViewProps> = ({
424417 const scrollRef = useRef < HTMLDivElement > ( null ) ;
425418 const toolbarHostRef = useRef < ToolbarHostHandle > ( null ) ;
426419
427- // --- Center split dragger (P7) ----------------------------------------------
428- // One dragger for the whole CodeView container. `--split-left` / `--split-right`
429- // are written on the container (light DOM); they inherit through every item's
430- // shadow root so usePierreTheme's split-grid rule resizes all split files'
431- // columns together. Shares the `review-split-ratio` storage key with the
432- // single-file DiffViewer so the chosen ratio is consistent across surfaces.
433- const showSplitDragger = diffStyle === 'split' && diffOverflow !== 'wrap' ;
434- const [ splitRatio , setSplitRatio ] = useState ( ( ) => {
435- const saved = storage . getItem ( 'review-split-ratio' ) ;
436- const n = saved ? Number ( saved ) : NaN ;
437- return ! Number . isNaN ( n ) && n >= 0.2 && n <= 0.8 ? n : 0.5 ;
438- } ) ;
439- const splitRatioRef = useRef ( splitRatio ) ;
440- splitRatioRef . current = splitRatio ;
441- const [ isDraggingSplit , setIsDraggingSplit ] = useState ( false ) ;
442-
443- const handleSplitDragStart = useCallback ( ( e : React . PointerEvent ) => {
444- e . preventDefault ( ) ;
445- const container = scrollRef . current ;
446- if ( container == null ) return ;
447- setIsDraggingSplit ( true ) ;
448-
449- const onMove = ( moveEvent : PointerEvent ) => {
450- const rect = container . getBoundingClientRect ( ) ;
451- if ( rect . width <= 0 ) return ;
452- const ratio = ( moveEvent . clientX - rect . left ) / rect . width ;
453- setSplitRatio ( Math . min ( 0.8 , Math . max ( 0.2 , ratio ) ) ) ;
454- } ;
455- const onUp = ( ) => {
456- setIsDraggingSplit ( false ) ;
457- document . removeEventListener ( 'pointermove' , onMove ) ;
458- document . removeEventListener ( 'pointerup' , onUp ) ;
459- storage . setItem ( 'review-split-ratio' , String ( splitRatioRef . current ) ) ;
460- } ;
461- document . addEventListener ( 'pointermove' , onMove ) ;
462- document . addEventListener ( 'pointerup' , onUp ) ;
463- } , [ ] ) ;
464-
465- const resetSplitRatio = useCallback ( ( ) => {
466- setSplitRatio ( 0.5 ) ;
467- storage . setItem ( 'review-split-ratio' , '0.5' ) ;
468- } , [ ] ) ;
420+ // NOTE: no center split dragger on this surface (parity with the legacy
421+ // all-files view, which never had one). One global drag line spanning every
422+ // file is noise on files where a split is meaningless (new/deleted files),
423+ // and the columns default to Pierre's even 1fr/1fr split. The single-file
424+ // DiffViewer keeps its per-file dragger.
469425
470426 // The file path CodeView currently reports as visible (active-file highlight).
471427 // Reset on diff switch so stepping/highlighting never anchors on an old file.
@@ -550,24 +506,6 @@ export const AllFilesCodeView: React.FC<AllFilesCodeViewProps> = ({
550506 [ files , patchHashes ] ,
551507 ) ;
552508
553- // Push the split ratio onto the container as CSS vars (P7). Setting them on the
554- // scroll container (not per item) is what lets the vars inherit into every
555- // item's shadow DOM where usePierreTheme's split-grid rule lives. Cleared when
556- // not in split+scroll mode so unified / wrap fall back to Pierre's default 1fr
557- // columns. Re-runs on fileSetKey because the CodeView remount recreates the
558- // container element, dropping any previously-set inline vars.
559- useEffect ( ( ) => {
560- const el = scrollRef . current ;
561- if ( el == null ) return ;
562- if ( showSplitDragger ) {
563- el . style . setProperty ( '--split-left' , `${ splitRatio } fr` ) ;
564- el . style . setProperty ( '--split-right' , `${ 1 - splitRatio } fr` ) ;
565- } else {
566- el . style . removeProperty ( '--split-left' ) ;
567- el . style . removeProperty ( '--split-right' ) ;
568- }
569- } , [ showSplitDragger , splitRatio , fileSetKey ] ) ;
570-
571509 // Visual-order list of file paths (for [/] stepping). Derived from items so it
572510 // matches CodeView's rendered order exactly.
573511 const orderedItemIds = useMemo (
@@ -1771,7 +1709,7 @@ export const AllFilesCodeView: React.FC<AllFilesCodeViewProps> = ({
17711709 ) ;
17721710
17731711 return (
1774- < div className = { ` relative h-full ${ isDraggingSplit ? 'select-none' : '' } ` } >
1712+ < div className = " relative h-full" >
17751713 < CodeView < DiffAnnotationMetadata >
17761714 // Remount on diff switch so uncontrolled `initialItems` re-seeds from
17771715 // the freshly computed identity. Without this, switching diff
@@ -1790,23 +1728,6 @@ export const AllFilesCodeView: React.FC<AllFilesCodeViewProps> = ({
17901728 renderAnnotation = { renderAnnotation }
17911729 />
17921730
1793- { /* Center split dragger (P7) — one vertical line for the whole CodeView
1794- container, pinned at `splitRatio` of its width. Positioned relative to
1795- the container (not any virtualized item), so it is unaffected by
1796- virtualization, sticky headers, or paged-scroll rebasing. The vars it
1797- writes resize every split file's columns uniformly. */ }
1798- { showSplitDragger && (
1799- < div
1800- className = "absolute top-0 bottom-0 z-20 cursor-col-resize group"
1801- style = { { left : `${ splitRatio * 100 } %` , width : 9 , marginLeft : - 4 } }
1802- onPointerDown = { handleSplitDragStart }
1803- onDoubleClick = { resetSplitRatio }
1804- title = "Drag to resize columns (double-click to reset)"
1805- >
1806- < div className = "pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border transition-[width,background-color] group-hover:w-0.5 group-hover:bg-primary/50 group-active:w-0.5 group-active:bg-primary/70" />
1807- </ div >
1808- ) }
1809-
18101731 < ToolbarHost
18111732 ref = { toolbarHostRef }
18121733 patch = { activePatch }
0 commit comments