mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 08:45:45 +02:00
Add quotes to hash file autocomplete (#7398)
# Description Fixes #6741. Autocompleting a dir/file named something like foo#bar will now complete to \`foo#bar\`
This commit is contained in:
@ -136,8 +136,12 @@ pub fn directory_completion(
|
||||
file_name.push(SEP);
|
||||
}
|
||||
|
||||
// Fix files or folders with quotes
|
||||
if path.contains('\'') || path.contains('"') || path.contains(' ') {
|
||||
// Fix files or folders with quotes or hash
|
||||
if path.contains('\'')
|
||||
|| path.contains('"')
|
||||
|| path.contains(' ')
|
||||
|| path.contains('#')
|
||||
{
|
||||
path = format!("`{}`", path);
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,12 @@ pub fn file_path_completion(
|
||||
file_name.push(SEP);
|
||||
}
|
||||
|
||||
// Fix files or folders with quotes
|
||||
if path.contains('\'') || path.contains('"') || path.contains(' ') {
|
||||
// Fix files or folders with quotes or hashes
|
||||
if path.contains('\'')
|
||||
|| path.contains('"')
|
||||
|| path.contains(' ')
|
||||
|| path.contains('#')
|
||||
{
|
||||
path = format!("`{}`", path);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user