0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00
[Editor] Change folded code text generation
This commit is contained in:
Trevor Buckner
2022-09-26 16:40:40 -04:00
committed by GitHub
2 changed files with 14 additions and 5 deletions

View File

@@ -355,12 +355,20 @@ const CodeEditor = createClass({
let text = '';
let currentLine = from.line;
const maxLength = 50;
let foldPreviewText = '';
while (currentLine <= to.line && text.length <= maxLength) {
text += this.codeMirror.getLine(currentLine);
if(currentLine < to.line)
text += ' ';
currentLine += 1;
const currentText = this.codeMirror.getLine(currentLine);
currentLine++;
if(currentText[0] == '#'){
foldPreviewText = currentText;
break;
}
if(!foldPreviewText && currentText != '\n') {
foldPreviewText = currentText;
}
}
text = foldPreviewText || `Lines ${from.line+1}-${to.line+1}`;
text = text.trim();
if(text.length > maxLength)

View File

@@ -13,7 +13,8 @@
font-family: inherit;
text-shadow: none;
font-weight: 600;
}
color: grey;
}
.sourceMoveFlash .CodeMirror-line{
animation-name: sourceMoveAnimation;