mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
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
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:
|
// The offset must be at least 2 because:
|
||||||
// - With each file an additional char is printed e.g. '@','*'.
|
// - With each file an additional char is printed e.g. '@','*'.
|
||||||
// - Each filename must be separated by a space.
|
// - 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;
|
printed_on_row += column_width;
|
||||||
|
|
||||||
for (size_t j = nprinted; i != (names.size() - 1) && j < column_width; ++j)
|
for (size_t j = nprinted; i != (names.size() - 1) && j < column_width; ++j)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue