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(){
29
29
#[ cfg( debug_assertions) ]
30
30
fn init_ctrlc_handler ( lines : usize ) {
31
31
ctrlc:: set_handler ( move || {
32
- utils:: clear_lines ( lines + 7 ) ;
32
+ utils:: clear_lines ( lines + 7 , true ) ;
33
33
std:: process:: exit ( 0 ) ;
34
34
} ) . expect ( "Failed to initialize ctrl-c handler" ) ;
35
35
}
@@ -93,7 +93,7 @@ fn dashboard(){
93
93
utils:: print_progress_bar ( ) ;
94
94
otp_helper:: show_codes ( & elements) ;
95
95
sleep ( Duration :: from_millis ( 1000 ) ) ;
96
- utils:: clear_lines ( elements. len ( ) + 1 ) ;
96
+ utils:: clear_lines ( elements. len ( ) + 1 , false ) ;
97
97
}
98
98
}
99
99
} ,
Original file line number Diff line number Diff line change @@ -59,9 +59,14 @@ pub fn print_progress_bar(){
59
59
println ! ( "[{:60}]" , "=" . repeat( idx as usize ) ) ;
60
60
}
61
61
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
+ }
65
70
}
66
71
67
72
You can’t perform that action at this time.
0 commit comments