This commit is contained in:
Fabian Becker 2024-11-18 13:45:00 +08:00 committed by GitHub
commit cf35c2942e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -11,8 +11,8 @@ export function generateCodeFrame(
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1
if (count >= start) {
for (let j = i - range; j <= i + range || end > count; j++) {
if (j < 0 || j >= lines.length) continue
for (let j = i - range; j < lines.length && (j <= i + range || end > count); j++) {
if (j < 0) continue
res.push(
`${j + 1}${repeat(` `, 3 - String(j + 1).length)}| ${lines[j]}`
)