private void MultilevelTextbox_TextChanged(object sender, EventArgs e) { if (guard) { return; } guard = true; var action = new MultilevelUndoTextboxChangeAction(MultilevelTextbox, oldText, oldSelectionStart, oldSelectionLength); multilevelTextboxActionManager.RecordAction(action); oldText = MultilevelTextbox.Text; oldSelectionStart = MultilevelTextbox.SelectionStart; oldSelectionLength = MultilevelTextbox.SelectionLength; UpdateMultilevelUndoRedoButtons(); guard = false; }
public override bool TryToMerge(IAction followingAction) { MultilevelUndoTextboxChangeAction action = followingAction as MultilevelUndoTextboxChangeAction; if (action == null) { return(false); } var timeDelta = action.timestamp.Subtract(this.timestamp); if (timeDelta.Seconds > 3) { return(false); } this.newText = action.newText; this.newSelectionStart = action.newSelectionStart; this.newSelectionLength = action.newSelectionLength; SetText(newText, newSelectionStart, newSelectionLength); return(true); }
private void MultilevelTextbox_TextChanged(object sender, EventArgs e) { if (guard) { return; } guard = true; var action = new MultilevelUndoTextboxChangeAction(MultilevelTextbox, oldText, oldSelectionStart, oldSelectionLength); multilevelTextboxActionManager.RecordAction(action); oldText = MultilevelTextbox.Text; oldSelectionStart = MultilevelTextbox.SelectionStart; oldSelectionLength = MultilevelTextbox.SelectionLength; UpdateMultilevelUndoRedoButtons(); guard = false; }