Skip to content

Commit 70c17f2

Browse files
committed
fixed chart width calculation for small terminals
1 parent fe7b9fe commit 70c17f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: t-plot.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const (
2424
defaultTermWidth = 80
2525
maxTermWidth = 150
2626
minChartWidth = 10
27+
widthReserve = 8
2728
)
2829

2930
type opt struct {
@@ -125,7 +126,7 @@ func addChart(cfg opt, lines []string, info []lineData, maxs lineData) []string
125126
if cfg.width > 0 {
126127
chartWidth = cfg.width
127128
} else {
128-
chartWidth = termWidth - maxs.width
129+
chartWidth = termWidth - maxs.width - widthReserve
129130
if chartWidth < minChartWidth {
130131
chartWidth = minChartWidth
131132
}

0 commit comments

Comments
 (0)