Zeile 21 | Zeile 21 |
---|
function Iter(cm, line, ch, range) { this.line = line; this.ch = ch; this.cm = cm; this.text = cm.getLine(line);
|
function Iter(cm, line, ch, range) { this.line = line; this.ch = ch; this.cm = cm; this.text = cm.getLine(line);
|
this.min = range ? range.from : cm.firstLine(); this.max = range ? range.to - 1 : cm.lastLine();
| this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine(); this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine();
|
}
function tagAt(iter, ch) {
| }
function tagAt(iter, ch) {
|
Zeile 140 | Zeile 140 |
---|
var openTag = toNextTag(iter), end; if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; if (!openTag[1] && end != "selfClose") {
|
var openTag = toNextTag(iter), end; if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; if (!openTag[1] && end != "selfClose") {
|
var start = Pos(iter.line, iter.ch); var close = findMatchingClose(iter, openTag[2]); return close && {from: start, to: close.from};
| var startPos = Pos(iter.line, iter.ch); var endPos = findMatchingClose(iter, openTag[2]); return endPos && {from: startPos, to: endPos.from};
|
} } });
| } } });
|
Zeile 163 | Zeile 163 |
---|
} };
|
} };
|
CodeMirror.findEnclosingTag = function(cm, pos, range) {
| CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {
|
var iter = new Iter(cm, pos.line, pos.ch, range); for (;;) {
|
var iter = new Iter(cm, pos.line, pos.ch, range); for (;;) {
|
var open = findMatchingOpen(iter);
| var open = findMatchingOpen(iter, tag);
|
if (!open) break; var forward = new Iter(cm, pos.line, pos.ch, range); var close = findMatchingClose(forward, open.tag);
| if (!open) break; var forward = new Iter(cm, pos.line, pos.ch, range); var close = findMatchingClose(forward, open.tag);
|