mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Improve quote path completions with drill-down (#4422)
This commit is contained in:
parent
886ed5ab2d
commit
a767fa369c
1 changed files with 2 additions and 12 deletions
|
@ -362,21 +362,11 @@ fn file_path_completion(
|
|||
) -> Vec<(nu_protocol::Span, String)> {
|
||||
use std::path::{is_separator, Path};
|
||||
|
||||
let partial = if let Some(s) = partial.strip_prefix('"') {
|
||||
s
|
||||
} else {
|
||||
partial
|
||||
};
|
||||
|
||||
let partial = if let Some(s) = partial.strip_suffix('"') {
|
||||
s
|
||||
} else {
|
||||
partial
|
||||
};
|
||||
let partial = partial.replace("\"", "");
|
||||
|
||||
let (base_dir_name, partial) = {
|
||||
// If partial is only a word we want to search in the current dir
|
||||
let (base, rest) = partial.rsplit_once(is_separator).unwrap_or((".", partial));
|
||||
let (base, rest) = partial.rsplit_once(is_separator).unwrap_or((".", &partial));
|
||||
// On windows, this standardizes paths to use \
|
||||
let mut base = base.replace(is_separator, &SEP.to_string());
|
||||
|
||||
|
|
Loading…
Reference in a new issue