@@ -28,7 +28,7 @@ import {
2828 onCleanup ,
2929 For ,
3030 Show ,
31- type JSX ,
31+
3232 type Accessor ,
3333} from "solid-js" ;
3434import { Icon } from "../ui/Icon" ;
@@ -562,15 +562,15 @@ function FileHeader(props: {
562562 readOnly ?: boolean ;
563563 onToggle : ( ) => void ;
564564 onOpenFile ?: ( ) => void ;
565- onStageFile ?: ( ) => void ;
566- onUnstageFile ?: ( ) => void ;
567- onRevertFile ?: ( ) => void ;
565+ onStageFile ?: ( ) => void | Promise < void > ;
566+ onUnstageFile ?: ( ) => void | Promise < void > ;
567+ onRevertFile ?: ( ) => void | Promise < void > ;
568568 focused ?: boolean ;
569569} ) {
570570 const [ isHovered , setIsHovered ] = createSignal ( false ) ;
571571 const [ actionLoading , setActionLoading ] = createSignal < string | null > ( null ) ;
572572
573- const handleAction = async ( action : ( ) => Promise < void > | undefined , name : string ) => {
573+ const handleAction = async ( action : ( ) => void | Promise < void > , name : string ) => {
574574 if ( ! action ) return ;
575575 setActionLoading ( name ) ;
576576 try {
@@ -595,7 +595,7 @@ function FileHeader(props: {
595595 cursor : "pointer" ,
596596 "user-select" : "none" ,
597597 "border-bottom" : `1px solid ${ tokens . colors . border . divider } ` ,
598- transition : `background ${ tokens . motion . duration . fast } ` ,
598+ transition : `background ${ tokens . transitions . fast } ` ,
599599 } }
600600 onClick = { props . onToggle }
601601 onMouseEnter = { ( ) => setIsHovered ( true ) }
@@ -829,7 +829,8 @@ function InlineDiffEditor(props: {
829829} ) {
830830 let containerRef : HTMLDivElement | undefined ;
831831 let diffEditorInstance : Monaco . editor . IStandaloneDiffEditor | null = null ;
832- let diffNavigator : Monaco . editor . IDiffNavigator | null = null ;
832+ // Track current change index for navigation (since Monaco's DiffNavigator is deprecated)
833+ let currentChangeIndex = 0 ;
833834 const monacoManager = MonacoManager . getInstance ( ) ;
834835
835836 onMount ( async ( ) => {
@@ -899,16 +900,40 @@ function InlineDiffEditor(props: {
899900 modified : modifiedModel ,
900901 } ) ;
901902
902- // Create diff navigator for change navigation
903- diffNavigator = monaco . editor . createDiffNavigator ( diffEditorInstance , {
904- followsCaret : true ,
905- ignoreCharChanges : true ,
906- } ) ;
903+ // Helper function to navigate to a specific change
904+ const goToChange = ( index : number ) => {
905+ if ( ! diffEditorInstance ) return ;
906+ const changes = diffEditorInstance . getLineChanges ( ) ;
907+ if ( ! changes || changes . length === 0 ) return ;
908+
909+ // Clamp index to valid range
910+ currentChangeIndex = Math . max ( 0 , Math . min ( index , changes . length - 1 ) ) ;
911+ const change = changes [ currentChangeIndex ] ;
912+
913+ // Reveal the change in the modified editor
914+ const modifiedEditor = diffEditorInstance . getModifiedEditor ( ) ;
915+ if ( modifiedEditor && change ) {
916+ modifiedEditor . revealLineInCenter ( change . modifiedStartLineNumber ) ;
917+ modifiedEditor . setPosition ( { lineNumber : change . modifiedStartLineNumber , column : 1 } ) ;
918+ }
919+ } ;
907920
908921 // Expose navigation methods
909922 props . onEditorReady ?.( {
910- goToNextChange : ( ) => diffNavigator ?. next ( ) ,
911- goToPreviousChange : ( ) => diffNavigator ?. previous ( ) ,
923+ goToNextChange : ( ) => {
924+ const changes = diffEditorInstance ?. getLineChanges ( ) ;
925+ if ( changes && changes . length > 0 ) {
926+ currentChangeIndex = ( currentChangeIndex + 1 ) % changes . length ;
927+ goToChange ( currentChangeIndex ) ;
928+ }
929+ } ,
930+ goToPreviousChange : ( ) => {
931+ const changes = diffEditorInstance ?. getLineChanges ( ) ;
932+ if ( changes && changes . length > 0 ) {
933+ currentChangeIndex = ( currentChangeIndex - 1 + changes . length ) % changes . length ;
934+ goToChange ( currentChangeIndex ) ;
935+ }
936+ } ,
912937 getChangesCount : ( ) => {
913938 const changes = diffEditorInstance ?. getLineChanges ( ) ;
914939 return changes ?. length ?? 0 ;
@@ -922,10 +947,6 @@ function InlineDiffEditor(props: {
922947 } ) ;
923948
924949 onCleanup ( ( ) => {
925- if ( diffNavigator ) {
926- diffNavigator . dispose ( ) ;
927- diffNavigator = null ;
928- }
929950 if ( diffEditorInstance ) {
930951 const model = diffEditorInstance . getModel ( ) ;
931952 if ( model ) {
0 commit comments