ls: Fix issue with too-narrow columns in "ls" output
There was a logic mistake in the code that computes the offset between columns, forgetting to account for the extra characters after a name. The comment was accurate, but the code didn't match the comment.
This commit is contained in:
parent
0a7d9319af
commit
3c73b6d531
Notes:
sideshowbarker
2024-07-19 03:04:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3c73b6d531b
1 changed files with 1 additions and 1 deletions
|
@ -421,7 +421,7 @@ int do_file_system_object_short(const char* path)
|
|||
// The offset must be at least 2 because:
|
||||
// - With each file an additional char is printed e.g. '@','*'.
|
||||
// - Each filename must be separated by a space.
|
||||
size_t column_width = longest_name + (offset > 0 ? offset : 2);
|
||||
size_t column_width = longest_name + max(offset, 2);
|
||||
printed_on_row += column_width;
|
||||
|
||||
for (size_t j = nprinted; i != (names.size() - 1) && j < column_width; ++j)
|
||||
|
|
Loading…
Add table
Reference in a new issue