diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index ebd4137e5..927b7c591 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -292,7 +292,7 @@ fn create_file_operation_prompt( path: &Path, callback: fn(&mut Context, &Path, &str) -> Result, ) { - cx.editor.path_editing = Some(path.to_path_buf()); + cx.editor.file_explorer_selected_path = Some(path.to_path_buf()); let callback = Box::pin(async move { let call: Callback = Callback::EditorCompositor(Box::new(move |editor, compositor| { let mut prompt = Prompt::new( @@ -304,7 +304,7 @@ fn create_file_operation_prompt( return; }; - let path = cx.editor.path_editing.clone(); + let path = cx.editor.file_explorer_selected_path.clone(); if let Some(path) = path { match callback(cx, &path, input) { @@ -318,7 +318,7 @@ fn create_file_operation_prompt( }, ); - if let Some(path_editing) = &editor.path_editing { + if let Some(path_editing) = &editor.file_explorer_selected_path { prompt.set_line_no_recalculate(path_editing.display().to_string()); } @@ -380,7 +380,7 @@ pub fn file_explorer(root: PathBuf, editor: &Editor) -> Result { - create_file_operation_prompt("create:", cx, path, |_, _, to_create_str| { + create_file_operation_prompt("create:", cx, path, |_cx, _path, to_create_str| { let to_create = helix_stdx::path::expand_tilde(PathBuf::from(to_create_str)); if to_create.exists() { @@ -388,11 +388,15 @@ pub fn file_explorer(root: PathBuf, editor: &Editor) -> Result Result Result { - let register = cx.editor.selected_register.unwrap_or(cx.editor.config().default_yank_register); + let register = cx.editor.selected_register.unwrap_or( + cx.editor.config().default_yank_register + ); let path = helix_stdx::path::get_relative_path(path); let path = path.to_string_lossy().to_string(); let message = format!("Yanked {} to register {register}", path); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 8e1ccd618..abda8bb63 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1035,7 +1035,6 @@ pub struct Editor { pub tree: Tree, pub next_document_id: DocumentId, pub documents: BTreeMap, - pub path_editing: Option, // We Flatten<> to resolve the inner DocumentSavedEventFuture. For that we need a stream of streams, hence the Once<>. // https://stackoverflow.com/a/66875668 @@ -1102,6 +1101,7 @@ pub struct Editor { pub mouse_down_range: Option, pub cursor_cache: CursorCache, + pub file_explorer_selected_path: Option, } pub type Motion = Box; @@ -1224,7 +1224,7 @@ impl Editor { handlers, mouse_down_range: None, cursor_cache: CursorCache::default(), - path_editing: None, + file_explorer_selected_path: None, } }