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

Commit

Permalink
Merge 52b0969 into 4daf24b
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjimenez authored Mar 25, 2023
2 parents 4daf24b + 52b0969 commit b6d56e6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
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

0 comments on commit b6d56e6

Please sign in to comment.