// Calculate the max column width for each element
184346
func (t *Tabulate) getWidths(headers []string, data []*TabulateRow) []int {
	widths := make([]int, len(headers))
	current_max := len(t.EmptyVar)
	for i := 0; i < len(headers); i++ {
		current_max = runewidth.StringWidth(headers[i])
		for _, item := range data {
			if len(item.Elements) > i && len(widths) > i {
				element := item.Elements[i]
				strLength := runewidth.StringWidth(element)
				if strLength > current_max {
					widths[i] = strLength
					current_max = strLength
				} else {
					widths[i] = current_max
				}
			}
		}
	}

	return widths
}
94654
func (t *ShellTable) padded() *ShellTable {
	maxColumnWidths := t.MaxColumnWidths()
	for _, r := range t.rows {
		for i, c := range r.columns {
			c.WriteString(padder(maxColumnWidths[i] - len(c.String())))
		}
	}
	return t
}
293303
func (opts *UniversalCompactionOptions) SetMaxMergeWidth(value uint) {
	C.rocksdb_universal_compaction_options_set_max_merge_width(opts.c, C.int(value))
}
140253
func (s Surface) gridBoxWidth() float64 {
	return s.bound.Width() / float64(s.Width-1)
}
1274949
func (m *Matrix) Col(col int) Vector {
	rows, _ := m.Size()
	values := make([]float64, rows)
	for row := 0; row < rows; row++ {
		values[row] = m.Get(row, col)
	}
	return Vector(values)
}
312243
func (t *tableCommon) WritableCols() []*table.Column {
	if len(t.writableColumns) > 0 {
		return t.writableColumns
	}
	writableColumns := make([]*table.Column, len(t.Columns))
	maxOffset := -1
	for _, col := range t.Columns {
		if col.State == model.StateDeleteOnly || col.State == model.StateDeleteReorganization {
			continue
		}
		writableColumns[col.Offset] = col
		if maxOffset < col.Offset {
			maxOffset = col.Offset
		}
	}
	return writableColumns[0 : maxOffset+1]
}
208012
func (m Mat4x3) Col(col int) Vec4 {
	return Vec4{m[col*4+0], m[col*4+1], m[col*4+2], m[col*4+3]}
}
1269607
func (win *Window) LayoutFitWidth(id int, minwidth int) {
	layout := win.layout
	if layout.Row.Type != layoutStatic || len(layout.Row.WidthArr) > 0 {
		panic(WrongLayoutErr)
	}
	if win.adjust == nil {
		win.adjust = make(map[int]map[int]*adjustCol)
	}
	adjust, ok := win.adjust[layout.Cnt]
	if !ok {
		adjust = make(map[int]*adjustCol)
		win.adjust[layout.Cnt] = adjust
	}
	col, ok := adjust[layout.Row.Index2]
	if !ok || col.id != id || col.font != win.ctx.Style.Font {
		if !ok {
			col = &adjustCol{id: id, width: minwidth}
			win.adjust[layout.Cnt][layout.Row.Index2] = col
		}
		col.id = id
		col.font = win.ctx.Style.Font
		col.width = minwidth
		col.first = true
		win.ctx.trashFrame = true
		win.LayoutSetWidth(minwidth)
		layout.Row.CalcMaxWidth = true
		return
	}
	win.LayoutSetWidthScaled(col.width)
	layout.Row.CalcMaxWidth = col.first
}
1022715
func Getsize(t *os.File) (rows, cols int, err error) {
	ws, err := GetsizeFull(t)
	return int(ws.Rows), int(ws.Cols), err
}
118987
func (t *Table) AutoSize(enabled bool, destWidth int) {
	if enabled {
		t.autoSize = destWidth
	} else {
		t.autoSize = 0
	}
}
871079
func (mat *MatMxN) NumRowCols() (rows, cols int) {
	return mat.m, mat.n
}
870244
func Width() int {
	ws, err := getWinsize()

	if err != nil {
		return -1
	}

	return int(ws.Col)
}
977515
func (c *ColumnMap) SetMaxSize(size int) *ColumnMap {
	c.MaxSize = size
	return c
}
809001
func AggMax(cols ...string) Aggregator {
	max := func(xs []float64) float64 {
		_, x := stats.Bounds(xs)
		return x
	}
	return aggFn(max, "max ", cols...)
}
407179
func (i *ASCIIArt) GetWidth() int {
	// Find the longest line
	var ret int
	for j := range i.contents {
		if len(i.contents[j]) > ret {
			ret = len(i.contents[j])
		}
	}
	return ret
}
1302725
func (s *Artwork) SetMaxWidth(v string) *Artwork {
	s.MaxWidth = &v
	return s
}
750798
func (c *TableCell) SetMaxWidth(maxWidth int) *TableCell {
	c.MaxWidth = maxWidth
	return c
}