public override void Undo()
{
ts.CurrentTB.BeginUpdate();
ts.CurrentTB.Selection.BeginUpdate();
try
{
for (int i = commandsByRanges.Count - 1; i >= 0; i--)
commandsByRanges[i].Undo();
}
finally
{
ts.CurrentTB.Selection.EndUpdate();
ts.CurrentTB.EndUpdate();
}
ts.CurrentTB.Selection = MainRange.Clone();
foreach (var r in ranges)
ts.CurrentTB.OnTextChanged(r);
ts.CurrentTB.OnSelectionChanged();
ts.CurrentTB.Selection.ColumnSelectionMode = false;
}