Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit 3503a3b

Browse files
anastasiya1155calyptobai
authored andcommitted
fixes after rebase
1 parent d07fe8a commit 3503a3b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

client/src/components/MarkdownWithCode/CodeRenderer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ const CodeRenderer = ({
8585
);
8686

8787
const linesToUse: [number, number] | undefined = useMemo(
88-
() => [lines[0] - 1, (lines[1] ?? lines[0]) - 1],
88+
() => [lines[0], lines[1] ?? lines[0]],
8989
[lines],
9090
);
9191

9292
const handleChipClick = useCallback(() => {
93-
updateScrollToIndex(`${lines[0] - 1}_${(lines[1] ?? lines[0]) - 1}`);
93+
updateScrollToIndex(`${lines[0]}_${lines[1] ?? lines[0]}`);
9494
}, [updateScrollToIndex, lines]);
9595

9696
return (
@@ -116,7 +116,7 @@ const CodeRenderer = ({
116116
language={matchLang?.[1] || ''}
117117
filePath={matchPath?.[1] || ''}
118118
onResultClick={openFileModal}
119-
startLine={lines[0] ? lines[0] - 1 : null}
119+
startLine={lines[0] ? lines[0] : null}
120120
repoName={repoName}
121121
/>
122122
)

client/src/components/MarkdownWithCode/LinkRenderer.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,13 @@ const LinkRenderer = ({
6565
}, [children]);
6666

6767
const linesToUse: [number, number] | undefined = useMemo(() => {
68-
return hideCode && start ? [start - 1, (end ?? start) - 1] : undefined;
68+
return hideCode && start ? [start, end ?? start] : undefined;
6969
}, [hideCode, start, end]);
7070

7171
const handleClickFile = useCallback(() => {
7272
hideCode
73-
? updateScrollToIndex(`${start - 1}_${(end ?? start) - 1}`)
74-
: openFileModal(
75-
filePath,
76-
start ? `${start - 1}_${(end ?? start) - 1}` : undefined,
77-
);
73+
? updateScrollToIndex(`${start}_${end ?? start}`)
74+
: openFileModal(filePath, start ? `${start}_${end ?? start}` : undefined);
7875
}, [hideCode, updateScrollToIndex, start, end, filePath]);
7976

8077
const handleClickFolder = useCallback(() => {

0 commit comments

Comments
 (0)