on master help sign in
Fix build on master
7511110Blaž Hrastnik
helix-term/src/commands.rs+14−10
@@ -1365,17 +1365,17 @@ mod cmd {
1365 .set_status(cx.editor.clipboard_provider.name().into());
1365 .set_status(cx.editor.clipboard_provider.name().into());
1366 }
1366 }
1367
1367
1368− fn change_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) {
1368+ fn change_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
1369 let dir = match args.first() {
1369 let dir = match args.first() {
1370 Some(dir) => dir,
1370 Some(dir) => dir,
1371 None => {
1371 None => {
1372− editor.set_error("target directory not provided".into());
1372+ cx.editor.set_error("target directory not provided".into());
1373 return;
1373 return;
1374 }
1374 }
1375 };
1375 };
1376
1376
1377 if let Err(e) = std::env::set_current_dir(dir) {
1377 if let Err(e) = std::env::set_current_dir(dir) {
1378− editor.set_error(format!(
1378+ cx.editor.set_error(format!(
1379 "Couldn't change the current working directory: {:?}",
1379 "Couldn't change the current working directory: {:?}",
1380 e
1380 e
1381 ));
1381 ));
@@ -1383,20 +1383,24 @@ mod cmd {
1383 }
1383 }
1384
1384
1385 match std::env::current_dir() {
1385 match std::env::current_dir() {
1386− Ok(cwd) => editor.set_status(format!(
1386+ Ok(cwd) => cx.editor.set_status(format!(
1387 "Current working directory is now {}",
1387 "Current working directory is now {}",
1388 cwd.display()
1388 cwd.display()
1389 )),
1389 )),
1390+ Err(e) => cx
1391+ .editor
1390− Err(e) => editor.set_error(format!("Couldn't get the new working directory: {}", e)),
1392+ .set_error(format!("Couldn't get the new working directory: {}", e)),
1391 }
1393 }
1392 }
1394 }
1393
1395
1394− fn show_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) {
1396+ fn show_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
1395 match std::env::current_dir() {
1397 match std::env::current_dir() {
1398+ Ok(cwd) => cx
1399+ .editor
1396− Ok(cwd) => editor.set_status(format!("Current working directory is {}", cwd.display())),
1400+ .set_status(format!("Current working directory is {}", cwd.display())),
1397− Err(e) => {
1401+ Err(e) => cx
1402+ .editor
1398− editor.set_error(format!("Couldn't get the current working directory: {}", e))
1403+ .set_error(format!("Couldn't get the current working directory: {}", e)),
1399− }
1400 }
1404 }
1401 }
1405 }
1402
1406