@@ -645,7 +645,7 @@ impl<'a> Pager<'a> {
645645 wrong_key : Option < char > ,
646646 ) -> UResult < ( ) > {
647647 self . draw_lines ( stdout, first_paint) ?;
648- self . draw_prompt ( stdout, wrong_key) ;
648+ self . draw_status_bar ( stdout, wrong_key) ;
649649 stdout. flush ( ) ?;
650650 Ok ( ( ) )
651651 }
@@ -699,15 +699,13 @@ impl<'a> Pager<'a> {
699699 }
700700 }
701701
702- /// Draws the status bar/prompt at the bottom of the screen
703- /// with appropriate progress information and user feedback
704- fn draw_prompt ( & mut self , stdout : & mut impl Write , wrong_key : Option < char > ) {
702+ fn draw_status_bar ( & mut self , stdout : & mut impl Write , wrong_key : Option < char > ) {
705703 // Calculate the index of the last visible line
706704 let lower_mark = ( self . upper_mark + self . content_rows ) . min ( self . lines . len ( ) - 1 ) ;
707705
708706 // Determine progress information to display
709707 // - Show next file name when at EOF and there is a next file
710- // - Otherwise show percentage through current file (if available)
708+ // - Otherwise show percentage of the file read (if available)
711709 let progress_info = if self . eof_reached && self . next_file . is_some ( ) {
712710 format ! ( "(Next file: {})" , self . next_file. unwrap( ) )
713711 } else {
@@ -730,13 +728,14 @@ impl<'a> Pager<'a> {
730728 // - In normal mode: ring bell (BELL char) on wrong key or show basic prompt
731729 let banner = match ( self . silent , wrong_key) {
732730 ( true , Some ( key) ) => format ! (
733- "{status} [Unknown key: '{key}'. Press 'h' for instructions. (unimplemented)]"
731+ "{status}[Unknown key: '{key}'. Press 'h' for instructions. (unimplemented)]"
734732 ) ,
735733 ( true , None ) => format ! ( "{status}{HELP_MESSAGE}" ) ,
736734 ( false , Some ( _) ) => format ! ( "{status}{BELL}" ) ,
737735 ( false , None ) => status,
738736 } ;
739737
738+ // Draw the status bar at the bottom of the screen
740739 write ! (
741740 stdout,
742741 "\r {}{banner}{}" ,
@@ -907,7 +906,7 @@ mod tests {
907906 . silent ( true )
908907 . build ( ) ;
909908 let mut buf = Vec :: new ( ) ;
910- pager. draw_prompt ( & mut buf, None ) ;
909+ pager. draw_status_bar ( & mut buf, None ) ;
911910 let buf_str = String :: from_utf8_lossy ( & buf) ;
912911 assert ! ( buf_str. contains( HELP_MESSAGE ) ) ;
913912 }
0 commit comments