Skip to content

Commit 5cd2074

Browse files
committed
style(table): improve naming of the resizer functions
1 parent 7862f52 commit 5cd2074

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

table/resizing.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ func (r *resizer) optimizedWidths() (colWidths, rowHeights []int) {
170170

171171
// detectTableWidth detects the table width.
172172
func (r *resizer) detectTableWidth() int {
173-
return r.maxCharCount() + r.totalPadding() + r.totalBorder()
173+
return r.maxCharCount() + r.totalHorizontalPadding() + r.totalHorizontalBorder()
174174
}
175175

176176
// expandTableWidth expands the table width.
177177
func (r *resizer) expandTableWidth() (colWidths, rowHeights []int) {
178178
colWidths = r.maxColumnWidths()
179179

180180
for {
181-
totalWidth := sum(colWidths) + r.totalBorder()
181+
totalWidth := sum(colWidths) + r.totalHorizontalBorder()
182182
if totalWidth >= r.tableWidth {
183183
break
184184
}
@@ -207,7 +207,7 @@ func (r *resizer) shrinkTableWidth() (colWidths, rowHeights []int) {
207207
// Cut width of columns that are way too big.
208208
shrinkBiggestColumns := func(veryBigOnly bool) {
209209
for {
210-
totalWidth := sum(colWidths) + r.totalBorder()
210+
totalWidth := sum(colWidths) + r.totalHorizontalBorder()
211211
if totalWidth <= r.tableWidth {
212212
break
213213
}
@@ -239,7 +239,7 @@ func (r *resizer) shrinkTableWidth() (colWidths, rowHeights []int) {
239239
// Cut width of columns that differ the most from the median.
240240
shrinkToMedian := func() {
241241
for {
242-
totalWidth := sum(colWidths) + r.totalBorder()
242+
totalWidth := sum(colWidths) + r.totalHorizontalBorder()
243243
if totalWidth <= r.tableWidth {
244244
break
245245
}
@@ -343,10 +343,10 @@ func (r *resizer) maxTotal() (maxTotal int) {
343343
return
344344
}
345345

346-
// totalPadding returns the total padding.
347-
func (r *resizer) totalPadding() (totalPadding int) {
346+
// totalHorizontalPadding returns the total padding.
347+
func (r *resizer) totalHorizontalPadding() (totalHorizontalPadding int) {
348348
for _, col := range r.columns {
349-
totalPadding += col.xPadding
349+
totalHorizontalPadding += col.xPadding
350350
}
351351
return
352352
}
@@ -367,8 +367,8 @@ func (r *resizer) xPaddingForCell(i, j int) int {
367367
return r.yPaddings[i][j]
368368
}
369369

370-
// totalBorder returns the total border.
371-
func (r *resizer) totalBorder() int {
370+
// totalHorizontalBorder returns the total border.
371+
func (r *resizer) totalHorizontalBorder() int {
372372
return (r.columnCount() * r.borderPerCell()) + r.extraBorder()
373373
}
374374

0 commit comments

Comments
 (0)