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:
pwygab
2022-12-09 04:37:10 +08:00
committed by GitHub
parent 4240bfb7b1
commit b39d797c1f
7 changed files with 70 additions and 5 deletions

View File

@ -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);
}

View File

@ -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);
}