-
Notifications
You must be signed in to change notification settings - Fork 51
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
base: master
Are you sure you want to change the base?
Conversation
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 |
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 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 { |
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.
Nit: why col
is checked for negative value but row
is not?
@@ -2,6 +2,8 @@ package clui | |||
|
|||
import ( | |||
"fmt" | |||
"strings" |
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.
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)
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.
Sure I will. I've been a bit busy, so I'll follow up on the next weekend.
If the column title includes
\n
, that column title weill break intotwo lines. If two adjacent titles on any row in the title are the same,
those lines will be merges to save space.