style: format

pull/12902/head
Nikita Revenco 2025-02-18 14:17:31 +00:00
parent 4fabd7927d
commit a97ebc2ed0
1 changed files with 24 additions and 9 deletions

View File

@ -283,7 +283,13 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
type FileExplorer = Picker<(PathBuf, bool), (PathBuf, Style)>; type FileExplorer = Picker<(PathBuf, bool), (PathBuf, Style)>;
type OnConfirm = fn(cursor: u32, cx: &mut Context, picker_root: PathBuf, &str, &Path) -> Option<Result<String, String>>; type OnConfirm = fn(
cursor: u32,
cx: &mut Context,
picker_root: PathBuf,
&str,
&Path,
) -> Option<Result<String, String>>;
fn create_confirmation_prompt( fn create_confirmation_prompt(
cursor: u32, cursor: u32,
@ -305,7 +311,13 @@ fn create_confirmation_prompt(
return; return;
}; };
match on_confirm(cursor, cx, picker_root.clone(), &operation_input_str, &operation_input) { match on_confirm(
cursor,
cx,
picker_root.clone(),
&operation_input_str,
&operation_input,
) {
Some(Ok(msg)) => cx.editor.set_status(msg), Some(Ok(msg)) => cx.editor.set_status(msg),
Some(Err(msg)) => cx.editor.set_error(msg), Some(Err(msg)) => cx.editor.set_error(msg),
None => (), None => (),
@ -370,8 +382,7 @@ fn create_file_operation_prompt(
fn refresh(cursor: Option<u32>, cx: &mut Context, root: PathBuf) { fn refresh(cursor: Option<u32>, cx: &mut Context, root: PathBuf) {
let callback = Box::pin(async move { let callback = Box::pin(async move {
let call: Callback = let call: Callback = Callback::EditorCompositor(Box::new(move |editor, compositor| {
Callback::EditorCompositor(Box::new(move |editor, compositor| {
if let Ok(picker) = file_explorer(cursor, root, editor) { if let Ok(picker) = file_explorer(cursor, root, editor) {
compositor.push(Box::new(overlay::overlaid(picker))); compositor.push(Box::new(overlay::overlaid(picker)));
} }
@ -381,7 +392,11 @@ fn refresh(cursor: Option<u32>, cx: &mut Context, root: PathBuf) {
cx.jobs.callback(callback); cx.jobs.callback(callback);
} }
pub fn file_explorer(cursor: Option<u32>, root: PathBuf, editor: &Editor) -> Result<FileExplorer, std::io::Error> { pub fn file_explorer(
cursor: Option<u32>,
root: PathBuf,
editor: &Editor,
) -> Result<FileExplorer, std::io::Error> {
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)?;