Fix bug where the program moves to the next word after typing the first word in line

This bug is caused because the currentLine is changed regardless of whether
the word is the last word in line or not.