Fix to the tab completion.

Supose that in a directory you have 2 subdirectories named foo and foobar.
If you type foo and <TAB>, we should not append os.sep at the end,
since foobar is still a valid option.