Clear the key buffer
Also, at the beginning of each iteration in Listing 2:
The clear_keybuf function is called: To clear out any old key data that may be left over in the buffer.
The clear_keybuf function is called:
To clear out any old key data that may be left over in the buffer.