Autocomplete only insert text in the last selection

When there's many selections and a value is selection in the autocomplete popup only the last selection is modified: 

![screenshot](http://i.imgur.com/wct0H6w.gif)