@@ -199,6 +199,8 @@ fn main() -> Result<(), failure::Error> {
199199
200200 app. clipboard_context = clipboard:: ClipboardProvider :: new ( ) . ok ( ) ;
201201
202+ app. help_docs_size = ui:: help:: get_help_docs ( ) . len ( ) as u32 ;
203+
202204 // Now that spotify is ready, check if the user has already selected a device_id to
203205 // play music on, if not send them to the device selection view
204206 if app. client_config . device_id . is_none ( ) {
@@ -210,6 +212,13 @@ fn main() -> Result<(), failure::Error> {
210212 loop {
211213 // Get the size of the screen on each loop to account for resize event
212214 if let Ok ( size) = terminal. backend ( ) . size ( ) {
215+ // Reset the help menu is the terminal was resized
216+ if app. size != size {
217+ app. help_menu_max_lines = 0 ;
218+ app. help_menu_offset = 0 ;
219+ app. help_menu_page = 0 ;
220+ }
221+
213222 app. size = size;
214223
215224 // Based on the size of the terminal, adjust the search limit.
@@ -218,6 +227,14 @@ fn main() -> Result<(), failure::Error> {
218227 app. large_search_limit = min ( ( f32:: from ( size. height ) / 1.4 ) as u32 , max_limit) ;
219228 app. small_search_limit =
220229 min ( ( f32:: from ( size. height ) / 2.85 ) as u32 , max_limit / 2 ) ;
230+
231+ // Based on the size of the terminal, adjust how many lines are
232+ // dislayed in the help menu
233+ if app. size . height > 8 {
234+ app. help_menu_max_lines = ( app. size . height as u32 ) - 8 ;
235+ } else {
236+ app. help_menu_max_lines = 0 ;
237+ }
221238 } ;
222239
223240 let current_route = app. get_current_route ( ) ;
0 commit comments