fix display bar bug
This commit is contained in:
parent
80f3226421
commit
5183083888
@ -68,12 +68,15 @@ void RawDisplayProgressBar(raw_progress_bar_t bar,size_t offset,size_t total,con
|
||||
else buf[i] = '.';
|
||||
}
|
||||
lock_scrolled();
|
||||
pos = scrolled - bar;
|
||||
if (pos > MAX_TERMINAL_ROW) {
|
||||
unlock_scrolled();
|
||||
return;
|
||||
}//optimization.
|
||||
//if ioctl failed? what should i do...
|
||||
ioctl(STDIN_FILENO,TIOCGWINSZ,(char *)&wnd_size);
|
||||
if (wnd_size.ws_row < pos) return;
|
||||
if (pos > MAX_TERMINAL_ROW) return;//optimization.
|
||||
pos = scrolled - bar;
|
||||
fprintf(stdout,"\x1b[%dA[%s]: %.2f%% %s bytes: %ld/%ld %d \x1b[%dB\r",pos,buf,cur_progress,filename,total,offset,pos,pos);
|
||||
fprintf(stdout,"\x1b[%dA[%s]: %.2f%% %s bytes: %ld/%ld \x1b[%dB\r",pos,buf,cur_progress,filename,total,offset,pos);
|
||||
fflush(stdout);
|
||||
unlock_scrolled();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user