Fix for extra space when tab completing directories. Fixes #1241