Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Ace fixes #420

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/editor-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ firepad.EditorClient = (function () {
var compose = this.undoManager.undoStack.length > 0 &&
inverse.shouldBeComposedWithInverted(last(this.undoManager.undoStack).wrapped);
var inverseMeta = new SelfMeta(this.cursor, cursorBefore);
this.undoManager.add(new WrappedOperation(inverse, inverseMeta), compose);

if (this.editorAdapter.ready) {
this.undoManager.add(new WrappedOperation(inverse, inverseMeta), compose);
}

this.applyClient(textOperation);
};

Expand Down
2 changes: 2 additions & 0 deletions lib/firepad.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ firepad.Firepad = (function(global) {
if (defaultText && self.isHistoryEmpty()) {
self.setText(defaultText);
}

self.editorAdapter_.ready = true;

self.trigger('ready');
});
Expand Down
5 changes: 5 additions & 0 deletions lib/text-operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ firepad.TextOperation = (function () {
// delete key.
return (startB + simpleB.chars === startA) || startA === startB;
}

// undo text replace in one go
if (simpleA.isDelete() && simpleB.isInsert()) {
return startA === startB;
}

return false;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/undo-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ firepad.UndoManager = (function () {

// Create a new UndoManager with an optional maximum history size.
function UndoManager (maxItems) {
this.maxItems = maxItems || 50;
this.maxItems = maxItems || 500;
this.state = NORMAL_STATE;
this.dontCompose = false;
this.undoStack = [];
Expand Down