This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
feat(layout): add support for multiple weighted constraints by chunks #519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Layout
allows users to split a givenRect
in multiple chunks according to list ofConstraints
. It has several shortcomings:tui
to have one chunk fill the remaining space — it only works in some cases because internally constraints are added to link the last chunk border and the edge of the area.This PR proposes 2 changes:
For example, let's say you have a table with 3 colums and you want the following behavior:
This can expressed as the following with the new changes — the higher the weight the stronger the constraint:
Known limitations: because we don't have a way to size based on content
Constraint::gte(0)
alone produces a zero width result which might not be expected from people used to more traditional layout system.Testing guidelines
Checklist