Fixed off-by-one issue

The off-by-one issue that caused words to not be processed if the
caret was at the end was fixed.  The issue was caused by the check
for the word start, which looks for the nearest space character.
If the caret is next to the closest space, it is skipped because
the check starts after it.  By subtracting one from the caret
position before doing the check, the correct word was picked up
at all of the needed locations.

This also cleans up the function that filters the users when looking
for matches.