Skip to content

Commit 2b90157

Browse files
authored
When a new log is loaded scroll to last ins (#84)
Instead of scrolling and selected the last line which is usually junk, scroll to the last ins which is right above the error msg.
1 parent 5a7f068 commit 2b90157

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/App.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,22 @@ function App() {
323323
onGotoEnd,
324324
]);
325325

326+
// When a new log is loaded go to the last instruction
326327
useEffect(() => {
327-
onGotoEnd();
328+
const visualIdx = logLineIdxToVisualIdx.get(verifierLogState.lastInsIdx);
329+
if (visualIdx === undefined) {
330+
return;
331+
}
332+
const clineId =
333+
verifierLogState.cSourceMap.logLineToCLine.get(
334+
verifierLogState.lastInsIdx,
335+
) || "";
336+
setSelectedAndScroll(
337+
verifierLogState.lastInsIdx,
338+
"",
339+
visualIdx,
340+
cLineIdToVisualIdx.get(clineId) || 0,
341+
);
328342
}, [verifierLogState]);
329343

330344
const loadInputText = useCallback(

0 commit comments

Comments
 (0)