0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 00:42:40 +00:00

Change filter to some

`some` stops once it finds a true case; `filter` has to process the whole list of folds first.
This commit is contained in:
Trevor Buckner
2024-08-26 17:23:44 -04:00
parent d59c6be359
commit 5671728c97

View File

@@ -160,11 +160,8 @@ const Editor = createClass({
// Don't process lines inside folded text
// If the current lineNumber is inside any folded marks, skip line styling
if(_.filter(foldLines, (fold)=>{
return lineNumber >= fold.from && lineNumber <= fold.to;
}).length > 0) {
if (foldLines.some(fold => lineNumber >= fold.from && lineNumber <= fold.to))
return;
};
// Styling for \page breaks
if((this.props.renderer == 'legacy' && line.includes('\\page')) ||
@@ -278,7 +275,7 @@ const Editor = createClass({
// Iterate over conflicting marks and clear them
var marks = codeMirror.findMarks(startPos, endPos);
marks.forEach(function(marker) {
marker.clear();
if(!marker.__isFold) marker.clear();
});
codeMirror.markText(startPos, endPos, { className: 'emoji' });
}