Move history substring search to the end