diff --git a/ivette/src/dome/renderer/text/editor.tsx b/ivette/src/dome/renderer/text/editor.tsx index 15d4be789fecea428a9029e0fd1db58c96521baa..64287c759db94780319661e5ab589b55312e9d2a 100644 --- a/ivette/src/dome/renderer/text/editor.tsx +++ b/ivette/src/dome/renderer/text/editor.tsx @@ -370,7 +370,7 @@ export function selectLine(view: View, line: number, atTop: boolean): void { const { from: goto } = doc.line(Math.max(line, 1)); if (here === goto) return; view.dispatch({ selection: { anchor: goto }, scrollIntoView: true }); - if (!atTop) return + if (!atTop) return; const effects = EditorView.scrollIntoView(goto, { y: 'start', yMargin: 0 }); view.dispatch({ effects }); } diff --git a/ivette/src/frama-c/kernel/SourceCode.tsx b/ivette/src/frama-c/kernel/SourceCode.tsx index b099a503816c8d12d0a32abe22bf374204440ac2..05cb75e067bbb82a96ec061a335b42c1df456c3a 100644 --- a/ivette/src/frama-c/kernel/SourceCode.tsx +++ b/ivette/src/frama-c/kernel/SourceCode.tsx @@ -165,13 +165,13 @@ const extensions: Editor.Extension[] = [ EventsHandler, ]; -function markerLocation(m: Ast.marker | undefined): Ast.source | undefined { +function useMarkerLocation(m: Ast.marker | undefined): Ast.source | undefined { const markersInfo = States.useSyncArray(Ast.markerInfo); if (m === undefined || m === '') return undefined; return markersInfo.getData(m)?.sloc; } -function functionLocation(fct: string | undefined): Ast.source | undefined { +function useFunctionLocation(fct: string | undefined): Ast.source | undefined { const functionsData = States.useSyncArray(Ast.functions).getArray(); if (fct === undefined || fct === '') return undefined; return functionsData.find((e) => e.name === fct)?.sloc; @@ -187,8 +187,8 @@ export default function SourceCode(): JSX.Element { const fct = selection?.current?.fct; const displayedFct = React.useRef<string | undefined>(undefined); - const markerSloc = markerLocation(marker); - const fctSloc = functionLocation(fct); + const markerSloc = useMarkerLocation(marker); + const fctSloc = useFunctionLocation(fct); const file = fctSloc?.file ?? ''; const filename = Path.parse(file).base;