#188 Fixed padding issues

closed-fixed
nobody
Bug fix (69)
5
2011-09-18
2011-08-10
No

A minor but very annoying issue, where numbers under 1000 passing through human_readable are padded incorrectly, because they lack decimal digits. Instead of adding meaningless (eg: 0.00B) decimal precision, I simply increased the width of the field.

Patch is attached. Please be so kind as to review and reply.

Discussion

  • pavelo

    pavelo - 2011-08-19

    Against which version of conky is this patch? Could you check if the version in git (either master or 1.8.2) exhibits this behavior? The function in question is different than the one you were editing, and a quick test of mine made me believe it works correctly now.

     
  • Chris Sakalis

    Chris Sakalis - 2011-08-19

    My patch is against 1.8.1
    I tried the master in git, but the problem remains the same. The human_readable function is indeed different but the patch seems applicable.

     
  • Chris Sakalis

    Chris Sakalis - 2011-08-23

    I remade the patch to work with git master

    --- conky.cc 2011-08-23 14:37:20.781533478 +0300
    +++ conky.cc 2011-08-23 14:35:05.014085435 +0300
    @@ -729,8 +729,13 @@ void human_readable(long long num, char
    }

    if (llabs(num) < 1000LL) {
    - spaced_print(buf, size, format, width, 0, (float)num, _(*suffix));
    - return;
    + if (llabs(num) < 10LL)
    + spaced_print(buf, size, format, width + 2, 0, (float) num, *suffix);
    + else if (llabs(num) < 100LL)
    + spaced_print(buf, size, format, width + 1, 0, (float) num, *suffix);
    + else
    + spaced_print(buf, size, format, width, 0, (float) num, *suffix);
    + return;
    }

    while (llabs(num / 1024) >= 1000LL && **(suffix + 2)) {

     
  • pavelo

    pavelo - 2011-09-18

    Your patch broke padding when "short_units yes" was in use. But i have fixed it in an another way. The change is in diff and will appear in the next release. Thanks for the report and sorry for the delay.

     
  • pavelo

    pavelo - 2011-09-18
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks