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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix table spacing and
omitEmpty
option #3139Fix table spacing and
omitEmpty
option #3139Changes from 5 commits
f46564e
72f0998
fdeda2c
f4d6eab
5c2b63a
449463d
1cc0a89
b6472f9
118a135
402b685
2326e0d
dc58a4c
8393fe3
d3bd42d
b07d536
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels inappropriate. OmitEmpty means "don't print if it's empty". This is doing the exact opposite.
The old implementation is definitely awkward, because if we don't omit the column for each row you're going to run into some weird results. But then further down we also have
shiftColsVal
which allows for columns to span based on theshiftCols=
param. Point is, this may all be by design, and this change you're making is backward incompatible. So either we need to audit existing use of this code and ensure it is compatible with your change, or we don't make any backward incompatible changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this is for the horizontal table mechanic, I suspect you can just revert this back to what it looked like before this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that's leftover from my initial implementation. It's been reverted now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only used on
rescaleColumns
and is based on inputs that are also passed to that function. So I suggest moving this logic insiderescaleColumns
.But also; what is the rationale here? Comment explaining this would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment, but left this here. There is a call further down to an
equalizeWidths
function that changes the column widths. Before that call the value of the first column is the original header width, which we want to respect when rescaling. I think it makes sense to preserve this, equalize all of the columns, and then ensure the header width is respected when rescaling, but I'm open to move this somewhere else or take a different approach.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think you missed the first part of my comment though:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I didn't explain well exactly what's happening here.
The call to
equalizeWidths
changes the actual values in thecolWidths
slice. So we have to grab the column width of the first entry in the slice at this point as this is the max width of the headers column. SoverticalHeaderWidth
can be a different value fromcolWidths[0]
after theequalizeWidths
call.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
verticalHeaderWidth
is either the value ofcolWidths[0]
or just 0. So either this conditional doesn't trigger, or it triggers ifcolWidths[0] < 0
, which feels inappropriate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in my other comment,
verticalHeaderWidth
is the value before equalization so it can differ fromcolWidths[0]
. I'll add a comment here as well.