diff options
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r-- | helix-term/src/commands.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f232f2c0..1370af45 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1365,17 +1365,17 @@ mod cmd { .set_status(cx.editor.clipboard_provider.name().into()); } - fn change_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) { + fn change_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) { let dir = match args.first() { Some(dir) => dir, None => { - editor.set_error("target directory not provided".into()); + cx.editor.set_error("target directory not provided".into()); return; } }; if let Err(e) = std::env::set_current_dir(dir) { - editor.set_error(format!( + cx.editor.set_error(format!( "Couldn't change the current working directory: {:?}", e )); @@ -1383,20 +1383,24 @@ mod cmd { } match std::env::current_dir() { - Ok(cwd) => editor.set_status(format!( + Ok(cwd) => cx.editor.set_status(format!( "Current working directory is now {}", cwd.display() )), - Err(e) => editor.set_error(format!("Couldn't get the new working directory: {}", e)), + Err(e) => cx + .editor + .set_error(format!("Couldn't get the new working directory: {}", e)), } } - fn show_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) { + fn show_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) { match std::env::current_dir() { - Ok(cwd) => editor.set_status(format!("Current working directory is {}", cwd.display())), - Err(e) => { - editor.set_error(format!("Couldn't get the current working directory: {}", e)) - } + Ok(cwd) => cx + .editor + .set_status(format!("Current working directory is {}", cwd.display())), + Err(e) => cx + .editor + .set_error(format!("Couldn't get the current working directory: {}", e)), } } |