Fix #131: Autocomplete commands&nicks with tab.

Pressing tab will now look for a nickname or chat command
that contains the last typed word (separated by the last unescaped
space) and complete it if possible.

For multiple matches, only the longest common prefix is inserted.