Implemented more faster & robust cursor position fixing logic

Existing behaviour was slow if the cursor has a large distance between the
anchor and focus nodes. It also tended to lose the first letter when right
near the start of a paragraph or root boundary.

New logic avoids the need for expensive positional lookups, instead
exploiting the fact that the actual step value of the cursor is expected
to be unmoved. This allows the start and end points of the range to be
simply moved to their nearest valid step.

Fixes issue #261