15 Commits
Author SHA1 Message Date
Sylvestre Ledru 4dced421b7 Fix clippy unreadable literal warnings 2026-03-09 22:52:32 +01:00
Jakob Nybo AndersenandSylvestre Ledru 2c1371a99c fix off-by-one in column-search loop and add regression test
The loop in `width_dimensions` used an exclusive upper bound
(`..self.cells.len()`), so it never tried placing all cells on a single
row. When cells have varying widths the single-row layout can fit even
though the widest-cell estimate rules it out, producing a suboptimal
result with more rows than necessary.

Change the range to `..=self.cells.len()` and add a regression test
that catches the bug.
2026-03-08 09:44:30 +01:00
Alexander Kjäll 970c31a9fc fix tests on 32-bit architecture 2025-09-18 09:20:56 +02:00
Daniel Hofstetter 2c4e778f3a clippy: fix warnings from uninlined_format_args 2025-06-27 11:17:41 +02:00
Leo Emar-KarandGitHub 07d49c4444 update width calculations (#48)
* optimize padding size calc

* remove separator duplication to reduce memory usage

* rework dimensions calculations

* add max possible width test

* simplify the min_columns calculation and add edge cases tests

* fix some comments and remove leftovers

* small improvements to variable names and comments
2025-04-10 09:59:51 +02:00
Leo Emar-KarGitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
c8db34bd41 add \t filling option (#46)
* chore(deps): update codecov/codecov-action action to v5

* add new Tabs filling and rework fmt process

* add filling_with_tabs test

* add tabs example

* update readme

* fix misspelling

* fix fmt in tests

* optimize padding size calc

* remove separator duplication to reduce memory usage

* make DEFAULT_SEPARATOR_SIZE pub

* fix padding calculation

* fix required padding is bigger than widest cell

* add next entry check before printing the separator

* update docs for tabs

* update comments

* add diff size separator with Tabs

* simplify the tabs number calculation

* update readme

* remove comments

* change last in row check to break

* fix some grammar in readme

* update docs with quotes for \t

* rename postion vars and add comment

* rename neares tab var and update comment

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-08 23:21:57 +02:00
Terts Diepraam 1522e5f5f9 fix: allow the screen to be filled exactly and fix off by one errors 2024-02-17 13:12:09 +01:00
Terts Diepraam a96ad3d86d fix widths for fallback to single column 2023-11-07 11:50:49 +01:00
Terts Diepraam 925b080d09 add license headers and remove extern crate 2023-11-03 21:09:16 +01:00
Terts Diepraam b9e42522ea make Grid::new always succeed
In uutils, we always fall back on printing everything in a single column
if the width is too small, so we simply use that as the default.
2023-10-31 20:40:55 +01:00
Terts Diepraam 7d37528db6 simplify API
Removes ability to fit into columns. All cells must be given up front. The
`Display` type is removed.
2023-10-31 16:45:46 +01:00
Terts DiepraamandSylvestre Ledru da74ffc216 remove alignment enum and field
The alignment settings are unused by both uutils and eza. So we don't
need to keep them around. Everything is now left-aligned. This
simplifies the code and makes the tests easier to write, too.
2023-09-25 08:06:14 +02:00
Terts Diepraam 800a7bf167 add some more tests 2022-11-20 17:53:45 +01:00
Terts Diepraam 2eae77b0dc clippy fixes 2022-11-19 19:04:11 +01:00
Terts Diepraam 0e29895273 move tests out of lib.rs and into tests/test.rs 2022-11-19 19:01:24 +01:00