Map up and down in history-substring-search properly