Skip to content

Commit 8eb1588

Browse files
committed
[comment-fold addon] Fix bug that broke folding of comments at start of line
Closes codemirror#4056
1 parent eabf5b5 commit 8eb1588

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

addon/fold/comment-fold.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
2929
}
3030
if (pass == 1 && found < start.ch) return;
3131
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
32-
(lineText.slice(found - endToken.length, found) == endToken ||
32+
(found == 0 || lineText.slice(found - endToken.length, found) == endToken ||
3333
!/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
3434
startCh = found + startToken.length;
3535
break;

0 commit comments

Comments
 (0)