fix prepended "/" when completing directory

This commit is contained in:
rabite0 2020-02-29 02:34:11 +01:00
parent 80678fb1f4
commit 853cf534a7
1 changed files with 8 additions and 1 deletions

View File

@ -409,8 +409,15 @@ pub fn find_files(comp_name: &str) -> HResult<Vec<OsString>> {
let mut completion = OsString::new();
if file.file_type()?.is_dir() {
completion.push(prefix.trim_end("/"));
completion.push("/");
// When completing something in the curren dir this will be empty
if completion != "" {
completion.push("/");
}
completion.push(name);
// Add final slash to directory
completion.push("/");
Ok(completion)
} else {
completion.push(prefix);