ratatui/tests
Dheepak Krishnamurthy 540fd2df03
feat(layout)!: Change Flex::default() (#881)
This PR makes a number of simplifications to the layout and constraint
features that were added after v0.25.0.

For users upgrading from v0.25.0, the net effect of this PR (along with
the other PRs) is the following:

- New `Flex` modes have been added.
  - `Flex::Start` (new default)
  - `Flex::Center`
  - `Flex::End`
  - `Flex::SpaceAround`
  - `Flex::SpaceBetween`
  - `Flex::Legacy` (old default)
- `Min(v)` grows to allocate excess space in all `Flex` modes instead of
shrinking (except in `Flex::Legacy` where it retains old behavior).
- `Fill(1)` grows to allocate excess space, growing equally with
`Min(v)`.

---

The following contains a summary of the changes in this PR and the
motivation behind them.

**`Flex`**

- Removes `Flex::Stretch`
- Renames `Flex::StretchLast` to `Flex::Legacy`

**`Constraint`**

- Removes `Fixed`
- Makes `Min(v)` grow as much as possible everywhere (except
`Flex::Legacy` where it retains the old behavior)
- Makes `Min(v)` grow equally as `Fill(1)` while respecting `Min` lower
bounds. When `Fill` and `Min` are used together, they both fill excess
space equally.

Allowing `Min(v)` to grow still allows users to build the same layouts
as before with `Flex::Start` with no breaking changes to the behavior.

This PR also removes the unstable feature `SegmentSize`.

This is a breaking change to the behavior of constraints. If users want
old behavior, they can use `Flex::Legacy`.

```rust
Layout::vertical([Length(25), Length(25)]).flex(Flex::Legacy)
```

Users that have constraint that exceed the available space will probably
not see any difference or see an improvement in their layouts. Any
layout with `Min` will be identical in `Flex::Start` and `Flex::Legacy`
so any layout with `Min` will not be breaking.

Previously, `Table` used `EvenDistribution` internally by default, but
with that gone the default is now `Flex::Start`. This changes the
behavior of `Table` (for the better in most cases). The only way for
users to get exactly the same as the old behavior is to change their
constraints. I imagine most users will be happier out of the box with
the new Table default.

Resolves https://github.com/ratatui-org/ratatui/issues/843

Thanks to @joshka for the direction
2024-01-29 09:37:50 -05:00
..
backend_termion.rs feat(terminal)!: add inline viewport (#114) 2023-04-17 14:23:50 +02:00
border_macro.rs feat(border): add border! macro for easy bitflag manipulation (#11) 2023-05-21 15:26:39 -07:00
state_serde.rs feat: Table column calculation uses layout spacing (#824) 2024-01-16 21:51:25 -05:00
stylize.rs feat(stylize): allow all widgets to be styled (#289) 2023-07-14 08:37:30 +00:00
terminal.rs feat: Add frame count (#766) 2024-01-08 03:51:53 -05:00
widgets_barchart.rs feat(barchart): Add direction attribute. (horizontal bars support) (#325) 2023-08-24 22:26:15 +00:00
widgets_block.rs fix(title): remove default alignment and position (#323) 2023-07-17 10:27:58 +00:00
widgets_calendar.rs feat(widgets): implement Widget for Widget refs (#833) 2024-01-24 10:34:10 -08:00
widgets_canvas.rs chore: Minor lints, making Clippy happier (#189) 2023-05-21 20:45:37 -07:00
widgets_chart.rs feat(widgets): implement Widget for Widget refs (#833) 2024-01-24 10:34:10 -08:00
widgets_gauge.rs fix(gauge): fix gauge widget colors (#572) 2023-10-19 04:29:53 -07:00
widgets_list.rs feat(List)!: List::new now accepts IntoIterator<Item = Into<ListItem>> (#672) 2023-12-08 14:20:49 -08:00
widgets_paragraph.rs chore(spans): remove deprecated Spans type (#426) 2023-09-19 02:58:52 -07:00
widgets_table.rs feat(layout)!: Change Flex::default() (#881) 2024-01-29 09:37:50 -05:00
widgets_tabs.rs feat(tabs): accept Iterators of Line in constructors (#776) 2024-01-10 17:16:44 -08:00