Unify cursor point finding logic
Fix for #261 (comment 1512359049)
- Leverage tests introduced on !308 (merged).
- Keep using
splitlines
in order to cover more newline boundaries (doc). - Signal invalid point by returning
-1
instead of raising an exception.
Edited by Bruno Cardoso