From bc4f267c6092f14d5f513bce69fc85d674be8fa5 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 7 Feb 2025 10:26:19 -0700 Subject: [PATCH] Do not show completion if already on an existing path --- src/tab.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tab.rs b/src/tab.rs index 3617d94..d2c69b2 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -237,13 +237,14 @@ pub fn folder_icon_symbolic(path: &PathBuf, icon_size: u16) -> widget::icon::Han fn tab_complete(path: &Path) -> Result, Box> { let parent = if path.exists() { - path + // Do not show completion if already on an existing path + return Ok(Vec::new()); } else { path.parent() .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 .to_str() .ok_or_else(|| format!("invalid UTF-8 {:?}", child_os))?;