Fixes asynchronous autocompleter prefix updating

Before this patch it could happen (if an async autocompleter returned late) that the prefix used in the autocomplete UI (underlining or highlighting) was out of date. This patch fixes that by recalculating the prefix again once the results returned. Not super efficient, but at least correct.