Update visible range calculation in App.tsx
This commit is contained in:
@@ -366,11 +366,12 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const updateVisibleRange = useCallback(() => {
|
const updateVisibleRange = useCallback(() => {
|
||||||
if (!showLineNumbersActive || !defaultLineHeight) return;
|
if (!showLineNumbersActive) return;
|
||||||
const textarea = textareaRef.current;
|
const textarea = textareaRef.current;
|
||||||
if (!textarea) return;
|
if (!textarea) return;
|
||||||
const scrollTop = textarea.scrollTop;
|
const scrollTop = textarea.scrollTop;
|
||||||
const viewportHeight = textarea.clientHeight;
|
const viewportHeight = textarea.clientHeight;
|
||||||
|
if (lineTopsRef.current.length === 0) return;
|
||||||
const start = findLineAtOffset(scrollTop);
|
const start = findLineAtOffset(scrollTop);
|
||||||
const end = findLineAtOffset(scrollTop + viewportHeight);
|
const end = findLineAtOffset(scrollTop + viewportHeight);
|
||||||
const buffer = 8;
|
const buffer = 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user