This commit is contained in:
nightwing 2012-04-03 00:00:44 +04:00
commit 299cdc1b19
2 changed files with 22 additions and 2 deletions

View file

@ -714,7 +714,7 @@ function Folding() {
// sometimes singleline folds can be missed by the code above
if (!range.isMultiLine()) {
fold = this.getFoldAt(range.start.row, range.start.column, 1);
if (fold && range.isEequal(fold.range)) {
if (fold && range.isEqual(fold.range)) {
this.removeFold(fold);
return;
}

View file

@ -51,7 +51,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
};
(function() {
this.isEequal = function(range) {
this.isEqual = function(range) {
return this.start.row == range.start.row &&
this.end.row == range.end.row &&
this.start.column == range.start.column &&
@ -117,6 +117,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
}
this.intersectsRange = function(range) {
var cmp = this.compareRange(range);
return (cmp == -1 || cmp == 0 || cmp == 1);
}
this.isEnd = function(row, column) {
return this.end.row == row && this.end.column == column;
}
@ -276,6 +281,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(start || this.start, end || this.end);
};
this.fixOrientation = function() {
if (
this.start.row < this.end.row
|| (this.start.row == this.end.row && this.start.column < this.end.column)
) {
return false;
}
var temp = this.start;
this.end = this.start;
this.start = temp;
return true;
};
this.isEmpty = function() {
return (this.start.row == this.end.row && this.start.column == this.end.column);
};