fix: update Score trait implementation and TUI initialization
Update the `Score` trait implementations to return a `Box<dyn Interpret>` instead of concrete types or clones where necessary. Additionally, refactor the initialization and cleanup in `HarmonyTUI` to use utility functions provided by `ratatui`.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::io;
|
||||
use crossterm::event::{self, Event};
|
||||
use harmony::maestro::Maestro;
|
||||
use ratatui::{self, layout::Position, prelude::CrosstermBackend, Frame, Terminal};
|
||||
use std::io;
|
||||
|
||||
pub mod tui {
|
||||
// Export any necessary modules or types from the internal tui module
|
||||
@@ -43,8 +43,7 @@ impl HarmonyTUI {
|
||||
|
||||
pub async fn init(self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
color_eyre::install()?;
|
||||
let backend = CrosstermBackend::new(io::stdout());
|
||||
let mut terminal = Terminal::new(backend)?;
|
||||
let mut terminal = ratatui::init();
|
||||
|
||||
loop {
|
||||
terminal.draw(|f| self.render(f))?;
|
||||
@@ -53,6 +52,8 @@ impl HarmonyTUI {
|
||||
}
|
||||
}
|
||||
|
||||
ratatui::restore();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user