File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ mod scroll_state;
2020mod state;
2121
2222fn handle_list ( app_state : & mut AppState , stdout : & mut StdoutLock ) -> Result < ( ) > {
23- let mut list_state = ListState :: new ( app_state, stdout) ?;
23+ let mut list_state = ListState :: build ( app_state, stdout) ?;
2424 let mut is_searching = false ;
2525
2626 loop {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ pub struct ListState<'a> {
4848}
4949
5050impl < ' a > ListState < ' a > {
51- pub fn new ( app_state : & ' a mut AppState , stdout : & mut StdoutLock ) -> io :: Result < Self > {
51+ pub fn build ( app_state : & ' a mut AppState , stdout : & mut StdoutLock ) -> Result < Self > {
5252 stdout. queue ( Clear ( ClearType :: All ) ) ?;
5353
5454 let name_col_title_len = 4 ;
@@ -64,7 +64,7 @@ impl<'a> ListState<'a> {
6464 let n_rows_with_filter = app_state. exercises ( ) . len ( ) ;
6565 let selected = app_state. current_exercise_ind ( ) ;
6666
67- let ( width, height) = terminal:: size ( ) ?;
67+ let ( width, height) = terminal:: size ( ) . context ( "Failed to get the terminal size" ) ?;
6868 let scroll_state = ScrollState :: new ( n_rows_with_filter, Some ( selected) , 5 ) ;
6969
7070 let mut slf = Self {
You can’t perform that action at this time.
0 commit comments