Rewrite of line boundary movement actions

Rewrite of line boundary detection logic to address numerous cursor movement issues (#555, #405, #227, #225, #224, #185, #124 and #98).

This also removes the last uses of the gui.SelectionMover class, allowing it to be removed in a subsequent PR.
My original idea (but badly expressed) was to have an overview of the general approach at the top of the method, so the code reader knows how to try to understand all the code lines in the method. But having the explanation split over the code parts also works, perhaps is even better.