Summary
Address two unresolved review comments from #569 (merged) that were identified after merge.
Issues
1. GreedyFrequencyStrategy: potential panic on short rows
File: internal/mycli/format/width_strategy_greedy.go:54
lo.Must(lo.Nth(in, columnIdx)) will panic if a row has fewer columns than len(headers). The other strategies (ProportionalStrategy, MarginalCostStrategy) already have bounds checks. The fix is to add a similar guard:
func(in Row) string {
if columnIdx < len(in) {
return in[columnIdx].RawText()
}
return ""
},
2. ProportionalStrategy: remaining width not distributed when totalDeficit == 0
File: internal/mycli/format/width_strategy_proportional.go:95
When the initial header-based allocation already covers the natural width of all columns (totalDeficit == 0), the remaining width is not distributed at all, resulting in a table narrower than available screen width. The fix is to restructure the distribution block so that leftover is always assigned even when totalDeficit == 0.
References
Scope
Summary
Address two unresolved review comments from #569 (merged) that were identified after merge.
Issues
1. GreedyFrequencyStrategy: potential panic on short rows
File:
internal/mycli/format/width_strategy_greedy.go:54lo.Must(lo.Nth(in, columnIdx))will panic if a row has fewer columns thanlen(headers). The other strategies (ProportionalStrategy,MarginalCostStrategy) already have bounds checks. The fix is to add a similar guard:2. ProportionalStrategy: remaining width not distributed when totalDeficit == 0
File:
internal/mycli/format/width_strategy_proportional.go:95When the initial header-based allocation already covers the natural width of all columns (
totalDeficit == 0), theremainingwidth is not distributed at all, resulting in a table narrower than available screen width. The fix is to restructure the distribution block so that leftover is always assigned even whentotalDeficit == 0.References
Scope
GreedyFrequencyStrategy.CalculateWidths()ProportionalStrategyto distribute remaining width whentotalDeficit == 0