Implement keypress action for console.