Fixed history-substring-search