Cool, safrol! I didn't know this could be done.
I've never used javascript so I can't be sure, but the problem with typing two spaces and then hitting tab may be because you are splitting your strings by a single space. So if you type
(note two spaces after slewb), when you split by " " you will end up with the array ["Hi", "I'm", "slewb", ""]. So when you hit tab in this case, lastWord is "", whose length is zero. in the line
Code:inputBox.value = currentInput.slice(0,-lastWord.length) + nickNames[possibleCompletions[tabIndex]]+" ";
you will be calling currentInput.slice(0, -0) which according to
this (I think) returns an empty string, which is why the previously typed text is deleted.
So instead of splitting by a single space, maybe try using a regular expression to split by one or more spaces -
see here. It looks like all you would need to do is replace the arguments when you call split to " +".
lol I hope I'm not 100 percent wrong on this, but try it out.
edit: actually I think that is still gonna mess things up since it will cut out some of the characters in currentInput. Maybe just keep it as it is and check if lastWord.length > 0 and act accordingly?