/// <summary>
/// Outdent the active selection one step
/// </summary>
public void Outdent(string Pattern)
{
if (!IsValid)
return;
Row xtr = null;
var ActionGroup = new UndoBlockCollection();
for (int i = LogicalBounds.FirstRow;
i <=
LogicalBounds.LastRow;
i++)
{
xtr = Control.Document[i];
var b = new UndoBlock();
b.Action = UndoAction.DeleteRange;
b.Position.X = 0;
b.Position.Y = i;
ActionGroup.Add(b);
string s = xtr.Text;
if (s.StartsWith(Pattern))
{
b.Text = s.Substring(0, Pattern.Length);
s = s.Substring(Pattern.Length);
}
xtr.Text = s;
}
if (ActionGroup.Count > 0)
Control.Document.AddToUndoList(ActionGroup);
Bounds = LogicalBounds;
Bounds.FirstColumn = 0;
Bounds.LastColumn = xtr.Text.Length;
Control.Caret.Position.X = LogicalBounds.LastColumn;
Control.Caret.Position.Y = LogicalBounds.LastRow;
}