Revert "Remove substring history search"

This reverts commit 0a02501a222de61de41885d4b881139f55e38226.