@@ -327,14 +327,11 @@ impl Screen {
327327 self . check_status ( ) ;
328328
329329 // Completely ignore impossibly small screens.
330- if screen_width < 4 {
330+ if screen_width < 4 || screen_height == 0 {
331331 return ;
332332 }
333333 let screen_width = usize:: try_from ( screen_width) . unwrap ( ) ;
334- if screen_height == 0 {
335- return ;
336- }
337- let screen_height = usize:: try_from ( curr_termsize. height ) . unwrap ( ) ;
334+ let screen_height = usize:: try_from ( screen_height) . unwrap ( ) ;
338335
339336 // Compute a layout.
340337 let layout = compute_layout (
@@ -379,7 +376,7 @@ impl Screen {
379376 }
380377
381378 // If the prompt doesn't occupy the full line, justify the command line to the end of the prompt.
382- let first_line_prompt_space = if layout. left_prompt_space == screen_width {
379+ let commandline_indent = if layout. left_prompt_space == screen_width {
383380 0
384381 } else {
385382 layout. left_prompt_space
@@ -392,7 +389,7 @@ impl Screen {
392389
393390 // Output the command line.
394391 let mut i = 0 ;
395- assert ! ( ( 0 ..= effective_commandline. len( ) ) . contains ( & cursor_pos ) ) ;
392+ assert ! ( cursor_pos <= effective_commandline. len( ) ) ;
396393 let scrolled_cursor = loop {
397394 // Grab the current cursor's x,y position if this character matches the cursor's offset.
398395 if i == cursor_pos {
@@ -443,7 +440,7 @@ impl Screen {
443440 effective_commandline. as_char_slice ( ) [ i] ,
444441 colors[ i] ,
445442 usize:: try_from ( indent[ i] ) . unwrap ( ) ,
446- first_line_prompt_space ,
443+ commandline_indent ,
447444 wcwidth_rendered_min_0 ( effective_commandline. as_char_slice ( ) [ i] ) ,
448445 ) {
449446 break scrolled_cursor. unwrap ( ) ;
0 commit comments