BUG: fixed whitespace remove with no empty line

Indexing bug results when no line ending is found.  This is fixed
through introducing default state.