add additional checks
This commit is contained in:
parent
3299f0759e
commit
4483598166
1 changed files with 12 additions and 0 deletions
|
|
@ -304,6 +304,9 @@ ace.Document = function(text, mode) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$insertLines = function(row, lines) {
|
this.$insertLines = function(row, lines) {
|
||||||
|
if (lines.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
var args = [row, 0];
|
var args = [row, 0];
|
||||||
args.push.apply(args, lines);
|
args.push.apply(args, lines);
|
||||||
this.lines.splice.apply(this.lines, args);
|
this.lines.splice.apply(this.lines, args);
|
||||||
|
|
@ -320,6 +323,9 @@ ace.Document = function(text, mode) {
|
||||||
},
|
},
|
||||||
|
|
||||||
this.$insert = function(position, text, fromUndo) {
|
this.$insert = function(position, text, fromUndo) {
|
||||||
|
if (text.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
if (this.lines.length <= 1) {
|
if (this.lines.length <= 1) {
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
@ -383,6 +389,9 @@ ace.Document = function(text, mode) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.remove = function(range, fromUndo) {
|
this.remove = function(range, fromUndo) {
|
||||||
|
if (range.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
this.$remove(range, fromUndo);
|
this.$remove(range, fromUndo);
|
||||||
|
|
||||||
this.fireChangeEvent(range.start.row,
|
this.fireChangeEvent(range.start.row,
|
||||||
|
|
@ -393,6 +402,9 @@ ace.Document = function(text, mode) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$remove = function(range, fromUndo) {
|
this.$remove = function(range, fromUndo) {
|
||||||
|
if (range.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!fromUndo && this.$undoManager) {
|
if (!fromUndo && this.$undoManager) {
|
||||||
var nl = this.$getNewLineCharacter();
|
var nl = this.$getNewLineCharacter();
|
||||||
this.$deltas.push({
|
this.$deltas.push({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue