pkgman: fix problems pointed out by Jerome & Axel.
This commit is contained in:
@@ -195,10 +195,14 @@ PackageManager::ProgressPackageDownloadActive(const char* packageName,
|
|||||||
"\xE2\x96\x88",
|
"\xE2\x96\x88",
|
||||||
};
|
};
|
||||||
|
|
||||||
struct winsize w;
|
int width = 70;
|
||||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
|
||||||
const int width = (w.ws_col > 77)
|
struct winsize winSize;
|
||||||
? 70 : (w.ws_col - 7); // we need 70 chars for the bar + 7 for %.
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winSize) == 0
|
||||||
|
&& winSize.ws_col < 77) {
|
||||||
|
// We need 7 characters for the percent display
|
||||||
|
width = windowSize.ws_col - 7;
|
||||||
|
}
|
||||||
|
|
||||||
int position;
|
int position;
|
||||||
int ipart = (int)(completionPercentage * width);
|
int ipart = (int)(completionPercentage * width);
|
||||||
|
|||||||
Reference in New Issue
Block a user