public override void Undo()
{
var tb = ts.CurrentTB;
ts.OnTextChanging();
tb.BeginUpdate();
tb.Selection.BeginUpdate();
for (int i = 0; i<ranges.Count; i++)
{
tb.Selection.Start = ranges[i].Start;
for (int j = 0; j < insertedText.Length; j++)
tb.Selection.GoRight(true);
ClearSelected(ts);
InsertTextCommand.InsertText(prevText[prevText.Count - i - 1], ts);
}
tb.Selection.EndUpdate();
tb.EndUpdate();
if (ranges.Count > 0)
ts.OnTextChanged(ranges[0].Start.iLine, ranges[ranges.Count - 1].End.iLine);
ts.NeedRecalc(new TextSource.TextChangedEventArgs(0, 1));
}