pull in changes from gary bernhart, add support for up/down arrow keys