aboutsummaryrefslogtreecommitdiff
path: root/src/bibiman.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bibiman.rs')
-rw-r--r--src/bibiman.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs
index 392ae95..41f549a 100644
--- a/src/bibiman.rs
+++ b/src/bibiman.rs
@@ -511,13 +511,13 @@ impl Bibiman {
tui.exit()?;
// Use VISUAL or EDITOR. Set "vi" as last fallback
let mut cmd: Command = EditorBuilder::new()
- .source(cfg.general.editor.as_ref())
+ .string(cfg.general.editor.as_ref())
.environment()
- .source(Some("vi"))
- .build()
- .unwrap();
+ .string(Some("vi"))
+ .build()?
+ .open_at(filepath, line_count as u32, 0);
// Prepare arguments to open file at specific line
- let status = cmd.arg(format!("+{}", line_count)).arg(filepath).status()?;
+ let status = cmd.status()?;
if !status.success() {
eprintln!("Spawning editor failed with status {}", status);
}
@@ -577,13 +577,13 @@ impl Bibiman {
tui.exit()?;
// Use VISUAL or EDITOR. Set "vi" as last fallback
let mut note_cmd: Command = EditorBuilder::new()
- .source(cfg.general.editor.clone())
+ .string(cfg.general.editor.clone())
.environment()
- .source(Some("vi"))
- .build()
- .unwrap();
+ .string(Some("vi"))
+ .build()?
+ .open(file);
// Prepare arguments to open file at specific line
- let status = note_cmd.arg(file).status()?;
+ let status = note_cmd.status()?;
if !status.success() {
eprintln!("Spawning editor failed with status {}", status);
}
@@ -625,13 +625,14 @@ impl Bibiman {
// Send GET request to doi resolver
let doi_entry = ureq::get(&doi_string)
- .set("Accept", "application/x-bibtex")
+ .header("Accept", "application/x-bibtex")
.call();
if let Ok(entry) = doi_entry {
// Save generated bibtex entry in structs field
let entry = entry
- .into_string()
+ .into_body()
+ .read_to_string()
.expect("Couldn't parse fetched entry into string");
self.popup_area.popup_sel_item = entry;
self.popup_area.popup_kind = Some(PopupKind::AppendToFile);