Fixed bounds issues with partialWordRange and previousWhitespacePosition.

These functions now better handle cases where the search position in the string is zero.