public void Disconnect() { this.UndoManagers.Clear(); this.UndoStack.Clear(); this.RedoStack.Clear(); this.initialState = null; this.currentState = null; }
public void Redo(ITextBuffer subjectBuffer) { if (this.RedoStack.Count > 0) { this.UndoStack.Push(this.currentState); this.currentState = this.RedoStack.Pop(); this.InlineRenameService.ActiveSession.ApplyReplacementText(this.currentState.ReplacementText, propagateEditImmediately: true); } }
public void Redo(ITextBuffer subjectBuffer) #pragma warning restore IDE0060 // Remove unused parameter { if (this.RedoStack.Count > 0) { this.UndoStack.Push(this.currentState); this.currentState = this.RedoStack.Pop(); this.InlineRenameService.ActiveSession.ApplyReplacementText(this.currentState.ReplacementText, propagateEditImmediately: true); } }
private void UpdateCurrentState(string replacementText, ITextSelection selection, SnapshotSpan activeSpan) { var snapshot = activeSpan.Snapshot; var selectionSpan = selection.GetSnapshotSpansOnBuffer(snapshot.TextBuffer).Single(); var start = selectionSpan.Start.TranslateTo(snapshot, PointTrackingMode.Positive).Position - activeSpan.Start.Position; var end = selectionSpan.End.TranslateTo(snapshot, PointTrackingMode.Positive).Position - activeSpan.Start.Position; this.currentState = new ActiveSpanState() { ReplacementText = replacementText, SelectionAnchorPoint = selection.IsReversed ? end : start, SelectionActivePoint = selection.IsReversed ? start : end }; }
public void CreateInitialState(string replacementText, ITextSelection selection, SnapshotSpan startingSpan) { UpdateCurrentState(replacementText, selection, startingSpan); this.initialState = this.currentState; }