Skip to content

No way to ask the formatter for a specific number of decimal places #1272

Open
@keysmashes

Description

@keysmashes

I just upgraded from 0.14 or so to 0.20.2, and I ran into a problem upgrading my config – there's no way to have things like the disk space or memory blocks display e.g. always 1 decimal place any more.

I didn't think I'd mind this that much, until I realised that in order to avoid potentially getting padding added to the start of a number, you have to set the minimum width to 1. (otherwise, if e.g. you set the minimum width to 2, you'll get padding if the number is less than 10; if the minimum width is 3, you'll get padding if the number is between 10 and 99; and so on.) So now in order to avoid getting extra padding before the amount of memory in my system (#1231), I have to do something like this:

format_mem = "{mem_used:1;_G*_}/{mem_total:1;_G*_}"

which displays no decimal places at all, which is quite annoying.

Would you be interested in adding the ability to set the minimum width of the integer and fractional parts of floats separately? e.g. {mem_used:1.2}, which would display at least 2 digits after the decimal point.

Alternatively, making some way to avoid the padding entirely would be nice, since you could then e.g. ask for a minimum width of 3, and get "123GB", "12.3GB", or "1.2GB" (rather than " 12GB" like it currently does) – in situations where it currently adds padding, it could just add extra precision on the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationChanges to or issues with configuration files

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions