Skip to content
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

Adds Multi-Row Column Titles #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

khaf
Copy link

@khaf khaf commented Feb 6, 2020

If the column title includes \n, that column title weill break into
two lines. If two adjacent titles on any row in the title are the same,
those lines will be merges to save space.

If the column title includes `\n`, that column title weill break into
two lines. If two adjacent titles on any row in the title are the same,
those lines will be merges to save space.
@@ -1027,7 +1093,8 @@ func (l *TableView) OnBeforeDraw(fn func(int, int, int, int)) {
// * rowCount - the number of visible rows
func (l *TableView) VisibleArea() (firstCol, firstRow, colCount, rowCount int) {
firstRow = l.topRow
maxDy := l.height - 3
maxDy := l.height - l.titleRows - 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I remember, 3 because of 1 for scrollbar. Now, if I understand the MR right, maxDy default value is 2. Why?

return ""
}

if len(l.titleParts[col]) > row {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: why col is checked for negative value but row is not?

@@ -2,6 +2,8 @@ package clui

import (
"fmt"
"strings"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment: could you add or change existing demo to show how to use such columns?

E.g, you can modify demos/tableview.go and unite two columns in the middle(I think, good candidates are "Number" and "Misc" - they are fairly small, adjacent and in the middle)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will. I've been a bit busy, so I'll follow up on the next weekend.

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