Improve history search using arrow keys