Fix command history selection with arrow keys.