public void RemoveFromSelection()
{
if (!accessible.StateSet.Contains(StateType.Enabled))
{
throw new ElementNotEnabledException();
}
int nSelections = text.NSelections;
for (int i = 0; i < nSelections; i++)
{
int start, end;
bool set = false;
text.GetSelection(i, out start, out end);
if (startOffset > start && startOffset < end)
{
startOffset = end;
set = true;
}
if (endOffset > start && endOffset < end)
{
endOffset = start;
set = true;
}
if (set)
{
if (endOffset < startOffset)
{
text.RemoveSelection(i);
i--;
}
else
{
text.SetSelection(i, startOffset, endOffset);
}
set = false;
}
}
}