Really automatically clear on errors

Commit 07c6055 introduced a fix for issue #22, so that we now
automatically clear the current input on a user mistake.

This commit just makes sure we actually always do that.

Specifically, we were missing the case where we had already reached the
maximum input length.

This commit also adds a unit test, to make sure we do not regress in the
future.