Fix autocomplete selection corner case

CORE-812

Emptying the field and selecting an autocomplete option wouldn't fill the field. Choosing same option again filled it, choosing it a third time, filled it incorrectly.

Likewise, after emptying the field, you could no longer select the same suggestion as was selected before.