window: When prefix-searching command history, stop only on distinct entries