fix caret moving to incorrect place after completing a tag

If you autocomplete a tag, for example "kafka" and after that autocomplete a tag "book" then caret will be at the fourth symbol like this "kafk|a, book", which is incorrect