Skip to content

Commit

Permalink
Convert Windows style path separator in completers to Unix style (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
ath3 authored Dec 29, 2021
1 parent 8c29b76 commit 49444f9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helix-term/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ pub mod completers {
return None;
}

//let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());

let path = entry.path();
let mut path = if is_tilde {
Expand All @@ -331,7 +331,12 @@ pub mod completers {
path.push("");
}

let path = path.to_str().unwrap().to_owned();
let path = if cfg!(windows) && is_dir {
// Convert Windows style path separator to Unix style
path.to_str().unwrap().replace("\\", "/")
} else {
path.to_str().unwrap().to_owned()
};
Some((end.clone(), Cow::from(path)))
})
}) // TODO: unwrap or skip
Expand Down

0 comments on commit 49444f9

Please sign in to comment.