diff options
| author | lukeflo | 2024-10-03 21:20:10 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-03 21:20:10 +0200 |
| commit | 2b5802ead34af39a5786ce6dba92949793ee52f7 (patch) | |
| tree | 215b5d258a67c3679896d2356ed909ba29ad23e3 /src/frontend/app.rs | |
| parent | 9617e3ab4df8bce42ce529685deed9e144654c88 (diff) | |
| download | bibiman-2b5802ead34af39a5786ce6dba92949793ee52f7.tar.gz bibiman-2b5802ead34af39a5786ce6dba92949793ee52f7.zip | |
working opening editor, need more sophisticated handling of file and args
Diffstat (limited to 'src/frontend/app.rs')
| -rw-r--r-- | src/frontend/app.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/frontend/app.rs b/src/frontend/app.rs index b66c775..faa54a1 100644 --- a/src/frontend/app.rs +++ b/src/frontend/app.rs @@ -60,7 +60,7 @@ pub struct App { // Is the application running? pub running: bool, // // tui initialization - pub tui: Tui, + // pub tui: Tui, // main bibliography pub main_biblio: BibiMain, // bibliographic data @@ -227,7 +227,7 @@ impl App { pub fn new() -> Result<Self> { // Self::default() let running = true; - let tui = Tui::new()?; + // let tui = Tui::new()?; let main_biblio = BibiMain::new(); let biblio_data = BibiData::new(&main_biblio.bibliography, &main_biblio.citekeys); let tag_list = TagList::from_iter(main_biblio.keyword_list.clone()); @@ -236,7 +236,7 @@ impl App { let current_area = CurrentArea::EntryArea; Ok(Self { running, - tui, + // tui, main_biblio, biblio_data, tag_list, @@ -264,7 +264,7 @@ impl App { // Handle events. match tui.next().await? { Event::Tick => self.tick(), - Event::Key(key_event) => handle_key_events(key_event, self)?, + Event::Key(key_event) => handle_key_events(key_event, self, &mut tui)?, Event::Mouse(_) => {} Event::Resize(_, _) => {} } @@ -518,16 +518,16 @@ impl App { citekey } - pub fn run_editor(&mut self) -> Result<()> { - self.tui.exit()?; + pub fn run_editor(&mut self, tui: &mut Tui) -> Result<()> { + tui.exit()?; let cmd = String::from("hx"); let args: Vec<String> = vec!["test.bib".into()]; let status = std::process::Command::new(&cmd).args(&args).status()?; if !status.success() { eprintln!("Spawning editor failed with status {}", status); } - self.tui.resume()?; - // self.tui.terminal.clear()?; + tui.enter()?; + tui.terminal.clear()?; Ok(()) } } |
