forked from extern/nushell
Merge pull request #175 from jonathandturner/improve_path_completions
Fix space and escaped paren completions
This commit is contained in:
commit
c6bbcf723f
@ -23,6 +23,24 @@ impl Completer for NuCompleter {
|
|||||||
|
|
||||||
let mut completions = self.file_completer.complete(line, pos, context)?.1;
|
let mut completions = self.file_completer.complete(line, pos, context)?.1;
|
||||||
|
|
||||||
|
for completion in &mut completions {
|
||||||
|
if completion.replacement.contains("\\ ") {
|
||||||
|
completion.replacement = completion.replacement.replace("\\ ", " ");
|
||||||
|
}
|
||||||
|
if completion.replacement.contains("\\(") {
|
||||||
|
completion.replacement = completion.replacement.replace("\\(", "(");
|
||||||
|
}
|
||||||
|
|
||||||
|
if completion.replacement.contains(" ") || completion.replacement.contains("(") {
|
||||||
|
if !completion.replacement.starts_with("\"") {
|
||||||
|
completion.replacement = format!("\"{}", completion.replacement);
|
||||||
|
}
|
||||||
|
if !completion.replacement.ends_with("\"") {
|
||||||
|
completion.replacement = format!("{}\"", completion.replacement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let line_chars: Vec<_> = line.chars().collect();
|
let line_chars: Vec<_> = line.chars().collect();
|
||||||
let mut replace_pos = pos;
|
let mut replace_pos = pos;
|
||||||
while replace_pos > 0 {
|
while replace_pos > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user