From 8eb15883501464b4518e40d22421bd2feafa8544 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Tue, 7 Jun 2016 12:30:53 +0200 Subject: [PATCH] [comment-fold addon] Fix bug that broke folding of comments at start of line Closes #4056 --- addon/fold/comment-fold.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/fold/comment-fold.js b/addon/fold/comment-fold.js index 60fa3e43df..e8d800eb59 100644 --- a/addon/fold/comment-fold.js +++ b/addon/fold/comment-fold.js @@ -29,7 +29,7 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) { } if (pass == 1 && found < start.ch) return; if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) && - (lineText.slice(found - endToken.length, found) == endToken || + (found == 0 || lineText.slice(found - endToken.length, found) == endToken || !/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) { startCh = found + startToken.length; break;