Fixed and tested keyboard_lastchar on Linux and Windows.