Fixed tab-completion with spaces and added tests