Tweak autocomplete/caret_position logic to not exclude the index 0 case

Fixes situation where autocomplete would bail if the cursor was at the beginning of the textarea, so usernames can be autocompleted as the first thing entered.