refactor: move statement elsewhere

This commit is contained in:
Nikita Revenco 2025-02-18 17:02:10 +00:00
parent a6e110937b
commit fae93aa308

View file

@ -413,18 +413,6 @@ pub fn file_explorer(
let directory_style = editor.theme.get("ui.text.directory");
let directory_content = directory_content(&root)?;
let columns = [PickerColumn::new(
"path",
|(path, is_dir): &(PathBuf, bool), (root, directory_style): &(PathBuf, Style)| {
let name = path.strip_prefix(root).unwrap_or(path).to_string_lossy();
if *is_dir {
Span::styled(format!("{}/", name), *directory_style).into()
} else {
name.into()
}
},
)];
let yank_path: KeyHandler = Box::new(|cx, (path, _), _, _| {
let register = cx
.editor
@ -664,6 +652,18 @@ pub fn file_explorer(
)
});
let columns = [PickerColumn::new(
"path",
|(path, is_dir): &(PathBuf, bool), (root, directory_style): &(PathBuf, Style)| {
let name = path.strip_prefix(root).unwrap_or(path).to_string_lossy();
if *is_dir {
Span::styled(format!("{}/", name), *directory_style).into()
} else {
name.into()
}
},
)];
let picker = Picker::new(
columns,
0,