From b67dc1621bde848d9d340f6b6ad45d0a8e628a20 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sat, 13 Nov 2021 20:57:33 -0500 Subject: [PATCH] More simplification to fold-code script --- shared/naturalcrit/codeEditor/fold-code.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/shared/naturalcrit/codeEditor/fold-code.js b/shared/naturalcrit/codeEditor/fold-code.js index e43fda8ec..cff1c64e0 100644 --- a/shared/naturalcrit/codeEditor/fold-code.js +++ b/shared/naturalcrit/codeEditor/fold-code.js @@ -6,13 +6,12 @@ module.exports = { if(start.line === cm.firstLine() || prevLine.match(matcher)) { const lastLineNo = cm.lastLine(); - let end = start.line, nextLine = cm.getLine(start.line + 1); + let end = start.line; while (end < lastLineNo) { - if(nextLine.match(matcher)) + if(cm.getLine(end + 1).match(matcher)) break; ++end; - nextLine = cm.getLine(end + 1); } return { @@ -24,4 +23,4 @@ module.exports = { return null; }); } -}; \ No newline at end of file +};