Skip to content

Commit

Permalink
refactor: remove RenderMode::Uninitialized
Browse files Browse the repository at this point in the history
its useless. just set a value and get on with your lives
  • Loading branch information
WilliamAnimate committed Nov 22, 2024
1 parent 0fe1a90 commit 1dc9f91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ impl Clone for SongControl {
}
}

#[derive(PartialEq, Debug)]
#[derive(PartialEq, Default)]
pub enum RenderMode {
Safe, // if term is too small, or if under resource constraints, or user specified, or
#[default]
Full, // the entire TUI
Safe, // if term is too small, or if under resource constraints, or user specified, or
NoSpace,
Uninitialized
}

#[derive(PartialEq, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
quit_with("argv[1] should be a media file or Encore-compatable playlist.", "argv[1] not supplied")?;
}

let mut render_requested_mode = encore::RenderMode::Full;
let mut render_requested_mode = encore::RenderMode::default();

if args.len() == 2 {
let mut first_arg = BufReader::new(File::open(&args[1])?);
Expand Down
3 changes: 1 addition & 2 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Tui<'_> {

Tui {
handle,
rendering_mode: RenderMode::Uninitialized,
rendering_mode: RenderMode::default(),
width: 0,
height: 0,
scrolling_offset: 0,
Expand Down Expand Up @@ -97,7 +97,6 @@ impl Tui<'_> {
RenderMode::Full => self.__draw_full()?,
RenderMode::Safe => self.__draw_safe()?,
RenderMode::NoSpace => self.__draw_not_enough_space()?,
RenderMode::Uninitialized => panic!("Invalid state: rendering_mode is Uninitialized."),
}

Ok(())
Expand Down

0 comments on commit 1dc9f91

Please sign in to comment.