修复报错代码提示行数比实际行数少1的bug

This commit is contained in:
shijian 2023-09-27 08:37:19 +08:00
parent 929c1b5008
commit 88f08292c8
1 changed files with 3 additions and 3 deletions

View File

@ -8521,15 +8521,15 @@
if(lines.length>=10){
if(line>4){
for(let i=line-5;i<line+6&&i<lines.length;i++){
showCode+=`${i}| ${line==i+1?'⚠️':''}${lines[i]}\n`;
showCode+=`${i+1}| ${line==i+1?'⚠️':''}${lines[i]}\n`;
}
}else{
for(let i=0;i<line+6&&i<lines.length;i++){
showCode+=`${i}| ${line==i+1?'⚠️':''}${lines[i]}\n`;
showCode+=`${i+1}| ${line==i+1?'⚠️':''}${lines[i]}\n`;
}
}
}else{
showCode=lines.map((_line,i)=>`${i}| ${line==i+1?'⚠️':''}${_line}\n`).toString();
showCode=lines.map((_line,i)=>`${i+1}| ${line==i+1?'⚠️':''}${_line}\n`).toString();
}
return showCode;
}