Skip to content

feat: Vertical Cell Merging In Table Columns #492

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

eloubens
Copy link

Changes

Merge adjacent vertical cells in the columns specified by a new []int field in the Table struct called borderMergeColumns.

Borders in between adjacent vertical cells containing identical data in these columns would be removed, where only the topmost cell's contents would remain with all other cell contents being hidden.

Example

Merge the first and last column
Screenshot 2025-03-14 at 2 29 20 PM

Screenshot 2025-03-14 at 2 28 47 PM

Details

This functionality would only work if both borderColumn and borderRow are set to true. For example, if a user wanted to merge vertical cells in columns 0, 2, 3, when creating the table, the user would need to add table.New().borderColumn(true).borderRow(true).BorderMergeColumns(0,2,3)

All other functionality would remain the same : borderColumn(true).borderRow(true) would just draw all borders, borderColumn(true).borderRow(false) would only draw the column borders... etc

Testing

All unit tests are in lipgloss/table/table_borders_test.go

@meowgorithm
Copy link
Member

Hi! Thanks for the contribution. This is an impressive implementation, however we're unlikely to merge it in the short term because of the upcoming v2 release (maintained on the v2-exp branch) and because of the impact on the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants