on master help sign in
Convert Windows style path separator in completers to Unix style (#1389)
49444f9ath3
helix-term/src/ui/mod.rs+7−2
@@ -313,7 +313,7 @@ pub mod completers {
313 return None;
313 return None;
314 }
314 }
315
315
316− //let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
316+ let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
317
317
318 let path = entry.path();
318 let path = entry.path();
319 let mut path = if is_tilde {
319 let mut path = if is_tilde {
@@ -331,7 +331,12 @@ pub mod completers {
331 path.push("");
331 path.push("");
332 }
332 }
333
333
334+ let path = if cfg!(windows) && is_dir {
335+ // Convert Windows style path separator to Unix style
336+ path.to_str().unwrap().replace("\\", "/")
337+ } else {
334− let path = path.to_str().unwrap().to_owned();
338+ path.to_str().unwrap().to_owned()
339+ };
335 Some((end.clone(), Cow::from(path)))
340 Some((end.clone(), Cow::from(path)))
336 })
341 })
337 }) // TODO: unwrap or skip
342 }) // TODO: unwrap or skip