mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 16:46:48 +01:00
Updates to the fold code function to standardise folding
Orig pull request approved by Marijn and merged into CodeMirror repo (Not this one, but my previous fix)
This commit is contained in:
@@ -37,7 +37,7 @@ CodeMirror.tagRangeFinder = function(cm, line) {
|
||||
if (-1 != slash && slash < gt) {
|
||||
var str = lineText.substr(slash, gt - slash + 1);
|
||||
if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag
|
||||
return l+1;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
l++;
|
||||
@@ -96,7 +96,7 @@ CodeMirror.tagRangeFinder = function(cm, line) {
|
||||
else
|
||||
depth++;
|
||||
if (!depth)
|
||||
return l+1;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
l++;
|
||||
@@ -144,7 +144,7 @@ CodeMirror.indentRangeFinder = function(cm, line) {
|
||||
return last + 1;
|
||||
};
|
||||
|
||||
CodeMirror.newFoldFunction = function(rangeFinder, markText) {
|
||||
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
|
||||
var folded = [];
|
||||
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">▼</div>%N%';
|
||||
|
||||
@@ -170,6 +170,8 @@ CodeMirror.newFoldFunction = function(rangeFinder, markText) {
|
||||
expand(cm, known.region);
|
||||
} else {
|
||||
var end = rangeFinder(cm, line);
|
||||
if (rangeFinder !== CodeMirror.indentRangeFinder && hideEnd === true) end++;
|
||||
console.log(rangeFinder !== CodeMirror.indentRangeFinder);
|
||||
if (end == null) return;
|
||||
var hidden = [];
|
||||
for (var i = line + 1; i < end; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user