diff --git a/ChangeLog b/ChangeLog index 71a2be3ddc6d80c57b3f445c627b4eb316360dbd..42b3f14e2ba0277b8edb934349a29b1f7de8dd17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ git - ? - Fixed non-void return in void delete_process() - Fixed several tiny memory leaks - Return to previously opened directory on failed recalculation + - Properly display MiB units instead of MB (IEEE 1541 - bug #2831412) 1.5 - 2009-05-02 - Fixed incorrect apparent size on directory refresh diff --git a/src/browser.c b/src/browser.c index 3cb354ac936376de64088f8a4b51260c729d3fd9..e30e19b12985cdeffcaac842bb1d9bf9325e4e58 100644 --- a/src/browser.c +++ b/src/browser.c @@ -161,10 +161,10 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) { /* reference to parent dir has a different format */ if(ispar) { mvhline(row, 0, ' ', wincols); - o = graph == 0 ? 11 : - graph == 1 ? 23 : - graph == 2 ? 18 : - 29 ; + o = graph == 0 ? 12 : + graph == 1 ? 24 : + graph == 2 ? 20 : + 31 ; mvaddstr(row, o, "/.."); if(n->flags & FF_BSEL) attroff(A_REVERSE); @@ -200,20 +200,20 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) { line = malloc(winrows+1); switch(graph) { case 0: - sprintf(line, "%%c %%7s %%c%%-%ds", wincols-12); - mvprintw(row, 0, line, ct, size, dt, cropstr(n->name, wincols-12)); + sprintf(line, "%%c %%8s %%c%%-%ds", wincols-13); + mvprintw(row, 0, line, ct, size, dt, cropstr(n->name, wincols-13)); break; case 1: - sprintf(line, "%%c %%7s [%%10s] %%c%%-%ds", wincols-24); - mvprintw(row, 0, line, ct, size, gr, dt, cropstr(n->name, wincols-24)); + sprintf(line, "%%c %%8s [%%10s] %%c%%-%ds", wincols-25); + mvprintw(row, 0, line, ct, size, gr, dt, cropstr(n->name, wincols-25)); break; case 2: - sprintf(line, "%%c %%7s [%%5.1f%%%%] %%c%%-%ds", wincols-20); - mvprintw(row, 0, line, ct, size, pc, dt, cropstr(n->name, wincols-19)); + sprintf(line, "%%c %%8s [%%5.1f%%%%] %%c%%-%ds", wincols-21); + mvprintw(row, 0, line, ct, size, pc, dt, cropstr(n->name, wincols-21)); break; case 3: - sprintf(line, "%%c %%7s [%%5.1f%%%% %%10s] %%c%%-%ds", wincols-31); - mvprintw(row, 0, line, ct, size, pc, gr, dt, cropstr(n->name, wincols-30)); + sprintf(line, "%%c %%8s [%%5.1f%%%% %%10s] %%c%%-%ds", wincols-32); + mvprintw(row, 0, line, ct, size, pc, gr, dt, cropstr(n->name, wincols-32)); } free(line); diff --git a/src/util.c b/src/util.c index 6c95ba00bc77d3e9cac789172dc8734ceb7d0d38..bd4c6372f0b1f5a12f5d1ef0711d730fbeae7125 100644 --- a/src/util.c +++ b/src/util.c @@ -33,7 +33,7 @@ int winrows, wincols; int subwinr, subwinc; char cropstrdat[4096]; -char formatsizedat[8]; +char formatsizedat[9]; /* "xxx.xMiB" */ char fullsizedat[20]; /* max: 999.999.999.999.999 */ char *getpathdat; int getpathdatl = 0; @@ -70,7 +70,7 @@ char *formatsize(const off_t from) { else if(r < 1023e6f) { c = 'M'; r/=1048576.0f; } else if(r < 1023e9f) { c = 'G'; r/=1073741824.0f; } else { c = 'T'; r/=1099511627776.0f; } - sprintf(formatsizedat, "%5.1f%cB", r, c); + sprintf(formatsizedat, "%5.1f%c%cB", r, c, c == ' ' ? ' ' : 'i'); return formatsizedat; }