Fixed the selection of autocomplete items.

The problem was that the text was being selected rather than the actual
list item.