Skip to content

free: Adjust column size to headers size, that vary across languages

Fix #204 (closed)

A few notes:

  • First column has no minimal size, the others have 12 (because numbers are padded at 11 + 1). Headers have at least 2 characters between them (as before).
  • I broke down the string containing the first line with headers in several ones. This allows every column to be resized if necessary.
  • I tested the fix manually (see below), but I believe it’s pretty solid. More testing should be done to ensure I didn’t break alignment in some cases.

Example output, with some headers changed with test values:

                             total        used        free      shared  buffer and cache   available
Mem:                      14268028     3956196     8125748       76196           2186084     9918744
Low:                      14268028     6142280     8125748
High:                            0           0           0
Partition d’échange:      16776512           0    16776512
Total:                    31044540     3956196    24902260
Comm:                     23910524    12886824    11023700
Edited by Mélanie Chauvel

Merge request reports