Fixed indentation when Enter is hit at the middle of a line.
Improved cursor positioning after re-indenting or sorting.