Annoying repeated text when I press escape and period simultaneously

I normally use Neovim to edit text documents. After the end of each sentence, I usually escape to insert mode, so I press period followed by escape quite a lot. Sometimes I accidentally press escape first and then period, and Neovim repeats what I just typed. This is of course what the period key is for, and I can easily undo the repeat by pressing “u” and append a period to my document.

However, sometimes I get really unlucky and press period and escape almost simultaneously, so that the escape key is held down while I press period. Then Neovim does something unexpected: it repeats the insert, but seems to consider the double insert as one edit rather than two separate ones, so that when I press “u”, it undoes the entire insert altogether - both the original insert and the repeat gets undone in one keystroke. Therefore, the fix I mentioned above does not work, and I need to manually go back and delete the repeat myself.

This behaviour persists when I start Neovim with the “-u NONE” option, but does not occur in Vim, which leads me to think that it might be a bug in Neovim.

For the sake of clarity, in order to try to reproduce the behaviour you should enter insert mode and type some text. Then hit escape followed by period in rapid succession. Afterwards, type “u” to see how much is considered by Neovim to be one edit.

Does anyone else experience the same problem? And is there a way to fix it?

Thanks in advance!