running the code on a Windows installation of Enigma.
What OS were you attempting to run this code on prior?
EDIT: After running the same code on Manjaro Linux, i'm noticing the problem, very prominently. I'll mess around with some things for a moment and get back to you.
EDIT2: In the game settings, I went to ENIGMA>API and set Platform from Linux X11 to SDL and it fixed things. I could hazard a guess that maybe in X11 mode when you hold a key down it registers the keystroke inputs in the same way a text editor would, in the way that holding w down will tell the game it's held down, then the window manager spams that key on and off like when you hold the letter down in a text form.
SDL seems to work fine on Linux, and tbh it's probably best to stick to cross-platform things anyway if they work. That's my personal belief though.