Don't add a space if completion only added a single "/"

This added a space if only one character was added, e.g.

```fish
cd dev<TAB>
```

would complete to

```fish
cd dev/<SPACE>
```

which makes picking deeper directories awkward.

So just go back to the old behavior of doing it for any length.

This is a regression from e27d97b02e.

cc @krobelus
This commit is contained in:
Fabian Homborg
2021-02-14 13:50:43 +01:00
parent 9a165b93fb
commit 552c7bc40b

View File

@@ -196,7 +196,7 @@ static complete_flags_t resolve_auto_space(const wcstring &comp, complete_flags_
if (flags & COMPLETE_AUTO_SPACE) {
new_flags &= ~COMPLETE_AUTO_SPACE;
size_t len = comp.size();
if (len > 1 && (std::wcschr(L"/=@:.,-", comp.at(len - 1)) != nullptr))
if (len > 0 && (std::wcschr(L"/=@:.,-", comp.at(len - 1)) != nullptr))
new_flags |= COMPLETE_NO_SPACE;
}
return new_flags;