Repository navigation
table: skip stacking vertically-merged rows that would misplace values - #436
Open
nk-batman21 wants to merge 1 commit into
Open
nk-batman21 wants to merge 1 commit into
nk-batman21 wants to merge 1 commit into
Conversation
Rows of a vertical merge are stacked into one block since jedib0t#411, but the block is still passed through the column's WidthMaxEnforcer as a whole. Enforcers like text.WrapSoft, text.WrapHard and text.Trim treat the stacked values as one text, so values end up on the wrong row or are cut off. A block that starts inside a merge also renders its merged column blank as a whole, hiding the values that follow. With RowConfig.AutoMerge, the horizontal merges of the block's first row are applied to every line, hiding the values of the other rows. A stacked column with VAlignMiddle or VAlignBottom moves its values onto other rows' lines. Render the rows of such a block one by one instead, as before jedib0t#411. A column using WrapSoft, WrapHard or Trim is now stacked only when its stacked values fit within WidthMax together.
|
Coverage Report for CI Build 39644424062Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.



Proposed Changes
WidthMaxEnforceras a whole.text.WrapSoftandtext.WrapHardre-flow the stacked values into each other andtext.Trimcuts them off, so once the values add up to more thanWidthMaxthey land on the wrong row, go missing, or push past the column border.RowConfig{AutoMerge: true}are stacked too, but the block's horizontal merges come from its first row:{"k", "x", "x"}followed by{"k", "y", "z"}showsyacross both columns andzis lost.combineVerticalMergeGroupnow reports the first two cases, and also a stacked column withVAlignMiddleorVAlignBottom, which moves its values onto other rows' lines.verticalMergeGroupEndno longer groups rows withRowConfig.AutoMerge. The rows of such a block are rendered one by one, as they were before table: stack vertically-merged rows into wrapped cell height; fixes #261 #411. Other blocks are still stacked for Vertical AutoMerge keeps unnecessary whitespace when a merged row value is wrapped by WidthMax #261, but aWrapSoftorWrapHardcolumn is now stacked only when its stacked values fit withinWidthMaxtogether.For example:
renders on v6.8.3:
and with this change, as on v6.8.2:
Ran:
make test-no-lintsteps (table stays at 100% coverage),golangci-lint run ./...(v2.7.2), and the table tests on Go 1.18.Checked: in 10000 random tables with merged columns, some using
RowConfig.AutoMerge,VAlignorRowVAlign, with each value tagged by its row: no value is lost, no border breaks and every value stays on its own row or in its merged cell; 8000 merged rows withWrapSoftorTrimrender about as fast as on main.