Fix line number generation in App.tsx
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user