mirror of https://github.com/helix-editor/helix
refactor: move statement elsewhere
parent
a6e110937b
commit
fae93aa308
|
@ -413,18 +413,6 @@ pub fn file_explorer(
|
||||||
let directory_style = editor.theme.get("ui.text.directory");
|
let directory_style = editor.theme.get("ui.text.directory");
|
||||||
let directory_content = directory_content(&root)?;
|
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 yank_path: KeyHandler = Box::new(|cx, (path, _), _, _| {
|
||||||
let register = cx
|
let register = cx
|
||||||
.editor
|
.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(
|
let picker = Picker::new(
|
||||||
columns,
|
columns,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue