aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bibiman.rs25
-rw-r--r--src/tui.rs4
-rw-r--r--src/tui/commands.rs4
3 files changed, 16 insertions, 17 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);
diff --git a/src/tui.rs b/src/tui.rs
index 990cdae..f7dae35 100644
--- a/src/tui.rs
+++ b/src/tui.rs
@@ -19,7 +19,7 @@ pub mod commands;
pub mod popup;
pub mod ui;
-use crate::{config::BibiConfig, App};
+use crate::{App, config::BibiConfig};
use crossterm::{
cursor,
event::{
@@ -31,7 +31,7 @@ use crossterm::{
use color_eyre::eyre::{OptionExt, Result};
use futures::{FutureExt, StreamExt};
use ratatui::backend::CrosstermBackend;
-use std::io::{stdout, Stdout};
+use std::io::{Stdout, stdout};
use std::panic;
use std::{
ops::{Deref, DerefMut},
diff --git a/src/tui/commands.rs b/src/tui/commands.rs
index 89fcf44..7099355 100644
--- a/src/tui/commands.rs
+++ b/src/tui/commands.rs
@@ -15,9 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/////
-use ratatui::crossterm::event::{
- Event, KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind,
-};
+use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind};
use tui_input::Input;
// // Possible ressources to open