fix: Use std::path::MAIN_SEPARATOR to determine completion

Refs #1439
This commit is contained in:
Blaž Hrastnik 2022-01-06 11:03:54 +09:00
parent b18bda928f
commit 3e4f81547c
2 changed files with 2 additions and 2 deletions

View File

@ -283,7 +283,7 @@ fn filename_impl<F>(input: &str, filter_fn: F) -> Vec<Completion>
let is_tilde = input.starts_with('~') && input.len() == 1;
let path = helix_core::path::expand_tilde(Path::new(input));
let (dir, file_name) = if input.ends_with('/') {
let (dir, file_name) = if input.ends_with(std::path::MAIN_SEPARATOR) {
(path, None)
} else {
let file_name = path

View File

@ -473,7 +473,7 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
}
}
key!(Enter) => {
if self.selection.is_some() && self.line.ends_with('/') {
if self.selection.is_some() && self.line.ends_with(std::path::MAIN_SEPARATOR) {
self.completion = (self.completion_fn)(&self.line);
self.exit_selection();
} else {