mirror of https://github.com/rivo/tview.git
Some clarifications in the Grid class as well as in the contributor guidelines. Resolves #231
This commit is contained in:
parent
e5e361b9d7
commit
1ac6fbc0c2
|
@ -15,7 +15,7 @@ Please note that this document is work in progress so I might add to it in the f
|
|||
|
||||
## Pull Requests
|
||||
|
||||
If you have a feature request, open an issue first before sending me a pull request. It may save you from writing code that will get rejected. If your case is strong, there is a good chance that I will add the feature for you.
|
||||
If you have a feature request, open an issue first before sending me a pull request, and allow for some discussion. It may save you from writing code that will get rejected. If your case is strong, there is a good chance that I will add the feature for you.
|
||||
|
||||
I'm very picky about the code that goes into this repo. So if you violate any of the following guidelines, there is a good chance I won't merge your pull request.
|
||||
|
||||
|
@ -26,6 +26,6 @@ I'm very picky about the code that goes into this repo. So if you violate any of
|
|||
- Your code must follow the structure of the existing code. Don't just patch something on. Try to understand how `tview` is currently designed and follow that design. Your code needs to be consistent with existing code.
|
||||
- If you're adding code that increases the work required to maintain the project, you must be willing to take responsibility for that extra work. I will ask you to maintain your part of the code in the long run.
|
||||
- Function/type/variable/constant names must be as descriptive as they are right now. Follow the conventions of the package.
|
||||
- All functions/types/variables/constants, even private ones, must have comments in good English. These comments must be elaborate enough so that new users of the package understand them and can follow them. Provide examples if you have to.
|
||||
- All functions/types/variables/constants, even private ones, must have comments in good English. These comments must be elaborate enough so that new users of the package understand them and can follow them. Provide examples if you have to. Start all sentences upper-case, as is common in English, and end them with a period.
|
||||
- Your changes must not decrease the project's [Go Report](https://goreportcard.com/report/github.com/rivo/tview) rating.
|
||||
- No breaking changes unless there is absolutely no other way.
|
||||
|
|
14
grid.go
14
grid.go
|
@ -171,12 +171,12 @@ func (g *Grid) SetBordersColor(color tcell.Color) *Grid {
|
|||
|
||||
// AddItem adds a primitive and its position to the grid. The top-left corner
|
||||
// of the primitive will be located in the top-left corner of the grid cell at
|
||||
// the given row and column and will span "width" rows and "height" columns. For
|
||||
// example, for a primitive to occupy rows 2, 3, and 4 and columns 5 and 6:
|
||||
// the given row and column and will span "rowSpan" rows and "colSpan" columns.
|
||||
// For example, for a primitive to occupy rows 2, 3, and 4 and columns 5 and 6:
|
||||
//
|
||||
// grid.AddItem(p, 2, 4, 3, 2, true)
|
||||
// grid.AddItem(p, 2, 5, 3, 2, true)
|
||||
//
|
||||
// If width or height is 0, the primitive will not be drawn.
|
||||
// If rowSpan or colSpan is 0, the primitive will not be drawn.
|
||||
//
|
||||
// You can add the same primitive multiple times with different grid positions.
|
||||
// The minGridWidth and minGridHeight values will then determine which of those
|
||||
|
@ -195,13 +195,13 @@ func (g *Grid) SetBordersColor(color tcell.Color) *Grid {
|
|||
// If the item's focus is set to true, it will receive focus when the grid
|
||||
// receives focus. If there are multiple items with a true focus flag, the last
|
||||
// visible one that was added will receive focus.
|
||||
func (g *Grid) AddItem(p Primitive, row, column, height, width, minGridHeight, minGridWidth int, focus bool) *Grid {
|
||||
func (g *Grid) AddItem(p Primitive, row, column, rowSpan, colSpan, minGridHeight, minGridWidth int, focus bool) *Grid {
|
||||
g.items = append(g.items, &gridItem{
|
||||
Item: p,
|
||||
Row: row,
|
||||
Column: column,
|
||||
Height: height,
|
||||
Width: width,
|
||||
Height: rowSpan,
|
||||
Width: colSpan,
|
||||
MinGridHeight: minGridHeight,
|
||||
MinGridWidth: minGridWidth,
|
||||
Focus: focus,
|
||||
|
|
Loading…
Reference in New Issue