Do not show completion if already on an existing path
This commit is contained in:
parent
868aa79127
commit
bc4f267c60
1 changed files with 3 additions and 2 deletions
|
|
@ -237,13 +237,14 @@ pub fn folder_icon_symbolic(path: &PathBuf, icon_size: u16) -> widget::icon::Han
|
||||||
|
|
||||||
fn tab_complete(path: &Path) -> Result<Vec<(String, PathBuf)>, Box<dyn Error>> {
|
fn tab_complete(path: &Path) -> Result<Vec<(String, PathBuf)>, Box<dyn Error>> {
|
||||||
let parent = if path.exists() {
|
let parent = if path.exists() {
|
||||||
path
|
// Do not show completion if already on an existing path
|
||||||
|
return Ok(Vec::new());
|
||||||
} else {
|
} else {
|
||||||
path.parent()
|
path.parent()
|
||||||
.ok_or_else(|| format!("path has no parent {:?}", path))?
|
.ok_or_else(|| format!("path has no parent {:?}", path))?
|
||||||
};
|
};
|
||||||
|
|
||||||
let child_os = path.strip_prefix(&parent).unwrap_or_else(|_| Path::new(""));
|
let child_os = path.strip_prefix(&parent)?;
|
||||||
let child = child_os
|
let child = child_os
|
||||||
.to_str()
|
.to_str()
|
||||||
.ok_or_else(|| format!("invalid UTF-8 {:?}", child_os))?;
|
.ok_or_else(|| format!("invalid UTF-8 {:?}", child_os))?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue