예제 #1
0
 public override void Undo()
 {
     TextSource.CurrentTextBox.Selection.Start = new Place(Sel.FromX, Math.Min(Sel.Start.Line, Sel.End.Line));
     TextSource.OnTextChanging();
     InsertTextCommand.InsertText(_deletedText, TextSource);
     TextSource.OnTextChanged(Sel.Start.Line, Sel.End.Line);
     TextSource.CurrentTextBox.Selection.Start = Sel.Start;
     TextSource.CurrentTextBox.Selection.End   = Sel.End;
 }
예제 #2
0
        public override void Execute()
        {
            var tb = TextSource.CurrentTextBox;

            _prevText.Clear();
            TextSource.OnTextChanging();
            tb.Selection.BeginUpdate();
            for (var i = _ranges.Count - 1; i >= 0; i--)
            {
                tb.Selection.Start = _ranges[i].ReplacedRange.Start;
                tb.Selection.End   = _ranges[i].ReplacedRange.End;
                _prevText.Add(tb.Selection.Text);
                ClearSelectedCommand.ClearSelected(TextSource);
                InsertTextCommand.InsertText(_ranges[i].ReplaceText, TextSource);
                TextSource.OnTextChanged(_ranges[i].ReplacedRange.Start.Line, _ranges[i].ReplacedRange.End.Line);
            }
            tb.Selection.EndUpdate();
            TextSource.NeedRecalc(new TextSource.TextChangedEventArgs(0, 1));
            LastSel = new RangeInfo(tb.Selection);
        }
예제 #3
0
        public override void Undo()
        {
            var tb = TextSource.CurrentTextBox;

            TextSource.OnTextChanging();
            tb.Selection.BeginUpdate();
            for (var i = 0; i < _ranges.Count; i++)
            {
                tb.Selection.Start = _ranges[i].ReplacedRange.Start;
                var j = 0;
                while (j < _ranges[i].ReplaceText.Length)
                {
                    tb.Selection.GoRight(true);
                    j++;
                }
                ClearSelectedCommand.ClearSelected(TextSource);
                var prevTextIndex = _ranges.Count - 1 - i;
                InsertTextCommand.InsertText(_prevText[prevTextIndex], TextSource);
                TextSource.OnTextChanged(_ranges[i].ReplacedRange.Start.Line, _ranges[i].ReplacedRange.Start.Line);
            }
            tb.Selection.EndUpdate();
            TextSource.NeedRecalc(new TextSource.TextChangedEventArgs(0, 1));
        }