Create ElidableList, an instance of Cell which can be dropped atomically#34
Draft
Xitian9 wants to merge 5 commits intomuesli4:masterfrom
Draft
Create ElidableList, an instance of Cell which can be dropped atomically#34Xitian9 wants to merge 5 commits intomuesli4:masterfrom
Xitian9 wants to merge 5 commits intomuesli4:masterfrom
Conversation
Collaborator
Author
muesli4
reviewed
Oct 25, 2022
Owner
muesli4
left a comment
There was a problem hiding this comment.
Great changes but they need a little bit of work.
The trim function will no longer produce garbage if given a length that is longer than the Cell to trim. Previously the only way to safely trim was with the trimOrPad function, which would also pad if the Cell was too short. This new function avoids this possibly unwanted effect. We also provide unsafe helper versions of the pad and fill functions which take the visibleLength of the Cell as an argument, ensuring that visibleLength is never calculated more than once.
This acts as a combination of fixedUntil and expandUntil: it will be of fixed length until the first argument, after which it will expand to match the size of the column up until the second argument. Also add test coverage for grid and the various column specs.
This ensures that columns really are the advertised width, even with very small column sizes.
2d882ea to
812c3e1
Compare
This adds dropLeftNoPad, dropRightNoPad, and dropBothNoPad to the Cell typeclass. These can be used to get tighter bounds on maximum column width with the expandUntil and expandBetween LenSpecs. This does not yet get tighter bounds when an AlignSpec other than NoAlign is used.
ElidableList takes something which is an instance of Cell and creates a list from which items will be dropped atomically.
muesli4
reviewed
Oct 29, 2022
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This code has been in hledger in another form for a while. But it actually suits the framework of Cell very well, so I've translated it and hoved it over here in case others find it useful.
Note that this PR depends on both #29 and #33, which are both fairly small PRs that are much simpler. You can either merge those individually, in which case I'll rebase this and you can review it on its own, or you can merge them all here.