public ArrayList<Box> getSelectionRegions()
{
ArrayList<Box> regions = new ArrayList<Box>();
boolean startsAtCaret = getCaretLocation().before(getSelectionLocation());
TextLocation start = startsAtCaret ? getCaretLocation() : getSelectionLocation();
TextLocation end = startsAtCaret ? getSelectionLocation() : getCaretLocation();
ArrayList<TypedLayout> lines = getLines();
int y = getY(start);
for(int i = start.line; i <= end.line; i++)
{