Fix negative counter number issue

Hello. The counter will be negative under some conditions, for example:
- Set `maxlength` to 10
- Type 9 letters and press enter key, then counter becomes -1  

Is `0` more reasonable?