diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 6340a58fe..da1390511 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -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) diff --git a/shared/naturalcrit/codeEditor/codeEditor.less b/shared/naturalcrit/codeEditor/codeEditor.less index c929e0d21..1334299e4 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.less +++ b/shared/naturalcrit/codeEditor/codeEditor.less @@ -13,7 +13,8 @@ font-family: inherit; text-shadow: none; font-weight: 600; - } + color: grey; +} .sourceMoveFlash .CodeMirror-line{ animation-name: sourceMoveAnimation;