From 86a0e98c36dbe1c8bbf04a0310f59b2804cf7ceb Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Fri, 29 Apr 2011 12:15:19 +0200 Subject: [PATCH] Reset the $redoStack of the undoManager once a delta is executed. Add Range.setStart/setEnd. --- lib/ace/range.js | 20 ++++++++++++++++++++ lib/ace/undomanager.js | 1 + 2 files changed, 21 insertions(+) diff --git a/lib/ace/range.js b/lib/ace/range.js index 8f22285d..23f7b236 100644 --- a/lib/ace/range.js +++ b/lib/ace/range.js @@ -115,6 +115,26 @@ var Range = function(startRow, startColumn, endRow, endColumn) { return this.start.row == row && this.start.column == column; } + this.setStart = function(row, column) { + if (typeof row == "object") { + this.start.column = row.column; + this.start.row = row.row; + } else { + this.start.row = row; + this.start.column = column; + } + } + + this.setEnd = function(row, column) { + if (typeof row == "object") { + this.end.column = row.column; + this.end.row = row.row; + } else { + this.end.row = row; + this.end.column = column; + } + } + this.inside = function(row, column) { if (this.compare(row, column) == 0) { if (this.isEnd(row, column) || this.isStart(row, column)) { diff --git a/lib/ace/undomanager.js b/lib/ace/undomanager.js index 5cb8e78b..66debe14 100644 --- a/lib/ace/undomanager.js +++ b/lib/ace/undomanager.js @@ -49,6 +49,7 @@ var UndoManager = function() { var deltas = options.args[0]; this.$doc = options.args[1]; this.$undoStack.push(deltas); + this.$redoStack = []; }; this.undo = function() {