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;
20
20
mod state;
21
21
22
22
fn 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) ?;
24
24
let mut is_searching = false ;
25
25
26
26
loop {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ pub struct ListState<'a> {
48
48
}
49
49
50
50
impl < ' 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 > {
52
52
stdout. queue ( Clear ( ClearType :: All ) ) ?;
53
53
54
54
let name_col_title_len = 4 ;
@@ -64,7 +64,7 @@ impl<'a> ListState<'a> {
64
64
let n_rows_with_filter = app_state. exercises ( ) . len ( ) ;
65
65
let selected = app_state. current_exercise_ind ( ) ;
66
66
67
- let ( width, height) = terminal:: size ( ) ?;
67
+ let ( width, height) = terminal:: size ( ) . context ( "Failed to get the terminal size" ) ?;
68
68
let scroll_state = ScrollState :: new ( n_rows_with_filter, Some ( selected) , 5 ) ;
69
69
70
70
let mut slf = Self {
You can’t perform that action at this time.
0 commit comments