예제 #1
0
 public void Disconnect()
 {
     this.UndoManagers.Clear();
     this.UndoStack.Clear();
     this.RedoStack.Clear();
     this.initialState = null;
     this.currentState = null;
 }
예제 #2
0
 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);
            }
        }
예제 #4
0
        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
            };
        }
예제 #5
0
 public void CreateInitialState(string replacementText, ITextSelection selection, SnapshotSpan startingSpan)
 {
     UpdateCurrentState(replacementText, selection, startingSpan);
     this.initialState = this.currentState;
 }