Skip to content

Commit

Permalink
minor updates on path completion
Browse files Browse the repository at this point in the history
  • Loading branch information
mitnk committed Nov 10, 2018
1 parent 5f14848 commit afa0de5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/completers/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,19 @@ pub fn complete_path(buffer: &str, for_dir: bool) -> Vec<Completion> {
name = str::replace(&name, "\'", "\\\'");
name = str::replace(&name, "*", "\\*");
}
let mut quoted = false;
if !path_sep.is_empty() {
name = tools::wrap_sep_string(&path_sep, &name);
quoted = true;
}
let suffix = if is_dir {
if quoted {
name = name.trim_end_matches(&path_sep).to_string();
}
Suffix::Some(MAIN_SEPARATOR)
} else {
Suffix::Default
};
if !path_sep.is_empty() {
name = tools::wrap_sep_string(&path_sep, &name);
}
res.push(Completion {
completion: name,
display,
Expand Down

0 comments on commit afa0de5

Please sign in to comment.