ComposeTweetWindow: Fix completion with empty word
Completion: Correctly hide window on space
ComposeTweetWindow: Move word detection into its own function

We will also need it in another place
ComposeTweetWindow: Fix completion in newline

This previously did not work because the way we detected the 'current
word'(i.e. the word the cursor is in) did not take newline texts into
consideration