nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 87612582ff9975552a20b14ef394b930a6a3fc97
parent c3a53cffbcf0c25706ba9cc5f3368c35c50b2467
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 13 Feb 2022 12:43:55 +0100

tweaks: use an intermediate variable, to avoid using one for two purposes

Diffstat:
Msrc/browser.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/browser.c b/src/browser.c @@ -50,22 +50,20 @@ void read_the_list(const char *path, DIR *dir) { size_t path_len = strlen(path), index = 0; const struct dirent *entry; - - longest = 0; + size_t widest = 0; /* Find the width of the widest filename in the current folder. */ while ((entry = readdir(dir)) != NULL) { size_t span = breadth(entry->d_name); - if (span > longest) - longest = span; + if (span > widest) + widest = span; index++; } - /* Put 10 characters' worth of blank space between columns of filenames - * in the list whenever possible, as Pico does. */ - longest += 10; + /* Reserve ten columns for blanks plus file size. */ + longest = widest + 10; /* If needed, make room for ".. (parent dir)". */ if (longest < 15)