fix: column style respects paddings and margins #160
Closed
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.
Address #130
A little context (copied and pasted from the issue):
What I found so far is this line.
cellStyle
is built by copingrowStyle
andinherit
acolumn.style
In its implementation in the lipgloss package, we can see that margins and padding properties are skipped
With that knowledge, I created a column with left padding
and change the renderRowColumnData a little bit
Which results in the desired state:
What we can do is:
Okay, it may be tricky because GetPadding and GetMargins return values or 0 if a property is not set. Creating a simple if statement as I did may result in a situation when a rowStyle sets padding to >0 value and the user wants to have a column with padding ==0 and it will not be overridden.
Without access lipgloss.Style.rules it may be hard to implement simply. We can cover the override margins/paddings with a next column flag but I do not if it is a best approach here
It came out that we cannot set paddings and margins in base style because it breaks the layout
PaddingRight(10)
MarginRight()