From d8722a3ddf9955afaf8dbd47bf88bc948268e345 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 23 Oct 2021 15:24:27 -0700 Subject: [PATCH] Swap file size and file type description position in pager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/wildcard.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 2e93e44b9..54636236d 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -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);