diff --git a/src/list.rs b/src/list.rs index cfd3720c..9f243a17 100644 --- a/src/list.rs +++ b/src/list.rs @@ -20,7 +20,7 @@ mod scroll_state; mod state; fn handle_list(app_state: &mut AppState, stdout: &mut StdoutLock) -> Result<()> { - let mut list_state = ListState::new(app_state, stdout)?; + let mut list_state = ListState::build(app_state, stdout)?; let mut is_searching = false; loop { diff --git a/src/list/state.rs b/src/list/state.rs index ed7c71f6..5bdbca77 100644 --- a/src/list/state.rs +++ b/src/list/state.rs @@ -48,7 +48,7 @@ pub struct ListState<'a> { } impl<'a> ListState<'a> { - pub fn new(app_state: &'a mut AppState, stdout: &mut StdoutLock) -> io::Result { + pub fn build(app_state: &'a mut AppState, stdout: &mut StdoutLock) -> Result { stdout.queue(Clear(ClearType::All))?; let name_col_title_len = 4; @@ -64,7 +64,7 @@ impl<'a> ListState<'a> { let n_rows_with_filter = app_state.exercises().len(); let selected = app_state.current_exercise_ind(); - let (width, height) = terminal::size()?; + let (width, height) = terminal::size().context("Failed to get the terminal size")?; let scroll_state = ScrollState::new(n_rows_with_filter, Some(selected), 5); let mut slf = Self {