Swap file size and file type description position in pager

File sizes are are always of variable length, while we there
are just a few different typrs of files. Since we right align,
this makes things look more lined up.

…ocal/bin/afsctool                (Executable, 74.0kB)
…ocal/bin/clang-format        (Executable link, 1.9MB)
…ocal/bin/clone_checker             (Executable, 33kB)
…ocal/bin/cryptest.exe              (Executable, 11MB)
…ocal/bin/cscc                      (Executable, 22kB)
…ocal/bin/cscout                   (Executable, 902kB)
…ocal/bin/csmake                    (Executable, 22kB)
…ocal/bin/cswc                     (Executable, 5.7kB)
…ocal/bin/dirb                      (Executable, 90kB)
…ocal/bin/ethminer-m1              (Executable, 4.8MB)
…ocal/bin/fork                (Executable link, 206kB)

vs

…ocal/bin/afsctool                (74.0kB, Executable)
…ocal/bin/clang-format        (1.9MB, Executable link)
…ocal/bin/clone_checker             (33kB, Executable)
…ocal/bin/cryptest.exe              (11MB, Executable)
…ocal/bin/cscc                      (22kB, Executable)
…ocal/bin/cscout                   (902kB, Executable)
…ocal/bin/csmake                    (22kB, Executable)
…ocal/bin/cswc                     (5.7kB, Executable)
…ocal/bin/dirb                      (90kB, Executable)
…ocal/bin/ethminer-m1              (4.8MB, Executable)
…ocal/bin/fork                (206kB, Executable link)
…ocal/bin/fish                     (2.4MB, Executable)
This commit is contained in:
Aaron Gyes 2021-10-23 15:24:27 -07:00
parent 2ed0105692
commit d8722a3ddf

View file

@ -38,7 +38,7 @@
/// Description for block device.
#define COMPLETE_BLOCK_DESC _(L"Block device")
/// Description for fifo buffer.
#define COMPLETE_FIFO_DESC _(L"Fifo")
#define COMPLETE_FIFO_DESC _(L"fifo")
/// Description for symlink.
#define COMPLETE_SYMLINK_DESC _(L"Symbolic link")
/// Description for symlink.
@ -509,14 +509,14 @@ static bool wildcard_test_flags_then_complete(const wcstring &filepath, const wc
// Compute the description.
wcstring desc;
if (expand_flags & expand_flag::gen_descriptions) {
desc = file_get_desc(lstat_res, lstat_buf, stat_res, stat_buf, stat_errno);
if (file_size >= 0) {
if (!desc.empty()) desc.append(L", ");
desc.append(format_size(file_size));
if (file_size >= 0)
desc = format_size(file_size);
if (!desc.empty()) {
desc.append(L", ");
desc.append(file_get_desc(lstat_res, lstat_buf, stat_res, stat_buf, stat_errno));
}
}
// Append a / if this is a directory. Note this requirement may be the only reason we have to
// call stat() in some cases.
auto desc_func = const_desc(desc);