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