adding fix for keypress handling, save and restore cursor methods as well as fix to handleSizeChange which had dims reversed