All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Some docstrings on the
ColumnConstraint
andWidth
enum were wrong.
- Add
Table::lines
, which returns an iterator over all lines of the final table output by dmaahs2017 for #35. - Add
ColumnConstraints::Boundaries{lower: Width, upper: Width}
to specify both an upper and a lower boundary.
- Fixed percentages sometimes weren't correctly calculated, due to not taking border columns into account.
- Return
None
forTable::get_table_width
, if getting the terminal size somehow failed. - Fixed a lot of possible, but highly unlikely number conversion overflow issues.
- Run space optimization under all circumstances.
- Percentage constraints with values of >100 will now be capped to 100.
- The MinConstraint would be ignored when:
- The content was larger than the min constraint
- There was less space available than specified in the constraint.
- The way ColumnConstraints are initialized has been changed. There is now
enum ColumnConstraints {
...,
/// Enforce a absolute width for a column.
Absolute(Width),
/// Specify a lower boundary, either fixed or as percentage of the total width.
LowerBoundary(Width),
/// Specify a upper boundary, either fixed or as percentage of the total width.
UpperBoundary(Width),
}
pub enum Width {
/// Specify a min amount of characters per line for a column.
Fixed(u16),
/// Set a a minimum percentage in respect to table_width for this column.
/// Values above 100 will be automatically reduced to 100.
/// **Warning:** This option will be ignored, if the width cannot be determined!
Percentage(u16),
}
Instead of the old
enum ColumnConstraints {
...,
Width(u16),
MinWidth(u16),
MaxWidth(u16),
Percentage(u16),
MinPercentage(u16),
MaxPercentage(u16),
}
- Remove most custom traits and replace them with std's generic
From
trait.
Check the docs on the trait implementations for Cell, Row and Cells - Add the
Cells
type, to allow super genericIterator -> Row
conversions.
DynamicFullWidth
arrangement. This mode is basically the same as theDynamic
arrangement mode, but it will always use the full available width, even if there isn't enough content to fill the space.
Dynamic arrangement
A new logic to optimize space usage after splitting content has been added.
If there is a lot of unused space after the content has been arranged, this space will now be redistributed ot the remaining columns.
Or it will be removed if there are no other columns.
This is considered a breaking change, since this can result in different table layouts!!
This process is far from perfect, but the behavior is better than before.
Old behavior:
+-----------------------------------+-----------------------------------+------+
| Header1 | Header2 | Head |
+==============================================================================+
| This is a very long line with a | This is text with a | smol |
| lot of text | anotherverylongtexttesttest | |
+-----------------------------------+-----------------------------------+------+
New behavior:
+-----------------------------------------+-----------------------------+------+
| Header1 | Header2 | Head |
+==============================================================================+
| This is a very long line with a lot of | This is text with a | smol |
| text | anotherverylongtexttesttest | |
+-----------------------------------------+-----------------------------+------+
Old behavior:
+------------------------------------------------+
| Header1 |
+================================================+
| This is text with a |
| anotherverylongtexttesttestaa |
+------------------------------------------------+
New behavior:
+-------------------------------+
| Header1 |
+===============================+
| This is text with a |
| anotherverylongtexttesttestaa |
+-------------------------------+
- Add the
NOTHING
preset, which prints no borders or lines at all.
- Add
table::trim_fmt
, which trims all trailing whitespaces on tables with no right border.
- Allow to set custom delimiters on tables, columns and cells.
- Expose all important traits. I.e.
ToRow
,ToCell
andToCells
.
- New ColumConstraint for hiding columns
- Add the option to set a max-height on rows. Long content will be truncated.
- A simple update of all dependencies.
- Move
is_tty
logic fromatty
tocrossterm
. - Remove
skeptic
, since it fails in CI and bloats compile time. Compile time is reduced by ca. 40%.
- The project has been in use for quite some time and seems to be quite stable!
- Use cargo's
example
functionality for examples.
Column::get_max_width()
, which returns the character count of the widest line in this column including padding.current_style_as_preset
method for convenient conversion of a style into a preset- New Markdown like table style prefix. Thanks to joeydumont.
- Better test coverage
- Fixed a bug with broken percentage constraints for super wide tables.
- Introduce proptest
- Fix wrong calculation due to bytes count instead of char count
- Fix panics caused by wrong string splits
- Crossterm 0.15 update
- Simplify the project's module structure
- Add
Column::remove_constraint()
- Preset
UTF8_NO_BORDERS
- Preset
UTF8_HORIZONTAL_BORDERS_ONLY
- Add skeptic tests
- Add code coverage
- A lot more tests
- Removed
Hidden
Constraint