Add formatSelectionExpanded which returns expanded ranges along with formatting results

We need this information to adjust selections correctly.
Preserve start column in formatSelectionOnly
Remove extra trailing new lines

Actually one should be careful to not include NewLine into the range. It
should be taken care of in the caller.

Fix #145.