File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ fn print_title(){
2929#[ cfg( debug_assertions) ]
3030fn init_ctrlc_handler ( lines : usize ) {
3131 ctrlc:: set_handler ( move || {
32- utils:: clear_lines ( lines + 7 ) ;
32+ utils:: clear_lines ( lines + 7 , true ) ;
3333 std:: process:: exit ( 0 ) ;
3434 } ) . expect ( "Failed to initialize ctrl-c handler" ) ;
3535}
@@ -93,7 +93,7 @@ fn dashboard(){
9393 utils:: print_progress_bar ( ) ;
9494 otp_helper:: show_codes ( & elements) ;
9595 sleep ( Duration :: from_millis ( 1000 ) ) ;
96- utils:: clear_lines ( elements. len ( ) + 1 ) ;
96+ utils:: clear_lines ( elements. len ( ) + 1 , false ) ;
9797 }
9898 }
9999 } ,
Original file line number Diff line number Diff line change @@ -59,9 +59,14 @@ pub fn print_progress_bar(){
5959 println ! ( "[{:60}]" , "=" . repeat( idx as usize ) ) ;
6060}
6161
62- pub fn clear_lines ( lines : usize ) {
63- // \x1B[{}A does not work during ctrl clear
64- print ! ( "\x1B [{}A\x1B [0G\x1B [0J" , lines) ;
62+ pub fn clear_lines ( lines : usize , exit : bool ) {
63+ if exit{
64+ // does not work during ctrl clear
65+ print ! ( "\x1B [{}A\x1B [0G\x1B [0J" , lines) ;
66+ }
67+ else {
68+ print ! ( "\x1B [{}A" , lines) ;
69+ }
6570}
6671
6772
You can’t perform that action at this time.
0 commit comments