Added support for somewhat greedy autocompletion

Added accompanying unit test