Fix line number generation in App.tsx

This commit is contained in:
2026-01-31 13:05:32 +01:00
parent 462c295893
commit 07cdf7421f

View File

@@ -162,10 +162,9 @@ export default function App() {
const historyIconSrc = theme === "light" ? historyIconBright : historyIcon; const historyIconSrc = theme === "light" ? historyIconBright : historyIcon;
const lines = useMemo(() => body.split("\n"), [body]); const lines = useMemo(() => body.split("
"), [body]);
return Array.from({ length: count }, (_, index) => index + 1); const lineNumbers = useMemo(() => lines.map((_, index) => index + 1), [lines]);
}, [body]);
const handleTextareaScroll = useCallback((event: React.UIEvent<HTMLTextAreaElement>) => { const handleTextareaScroll = useCallback((event: React.UIEvent<HTMLTextAreaElement>) => {
if (!showLineNumbers) return; if (!showLineNumbers) return;