Add current input to text to complete from

This let's you type a word not seen in the buffer and then later on
complete it in the same message.

Extract duplicated logic into get_input_line()
Move item updates to sensible locations
Style change
Rename item updater