Fix StringOutOfBoundsException on Windows.

Cursor would still regularly be outside of the line contents, causing StringOutOfBoundsExceptions in the 'insideIndentation' code.

Added tests to reproduce problem.

The function now returns when on an empty line or outside of the boundaries.