Don't use $lines in setValue and $clipPosition to
make subclassing easier
This commit is contained in:
parent
af0b9c2d57
commit
81a742e2f1
1 changed files with 3 additions and 2 deletions
|
|
@ -56,7 +56,8 @@ var Document = function(text) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.setValue = function(text) {
|
||||
this.remove(new Range(0, 0, this.$lines.length, this.getLine(this.$lines.length-1).length));
|
||||
var len = this.getLength();
|
||||
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
|
||||
this.insertLines(0, this.$split(text));
|
||||
};
|
||||
|
||||
|
|
@ -151,7 +152,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
this.$clipPosition = function(position) {
|
||||
var length = this.$lines.length;
|
||||
var length = this.getLength();
|
||||
if (position.row >= length) {
|
||||
position.row = Math.max(0, length - 1);
|
||||
position.column = this.getLine(length-1).length;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue