diff options
| -rw-r--r-- | dumbTable.go | 6 | ||||
| -rw-r--r-- | humanTable.go | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/dumbTable.go b/dumbTable.go index fe972a8..05b5f58 100644 --- a/dumbTable.go +++ b/dumbTable.go @@ -58,7 +58,7 @@ func SimpleTable(data [][]string) string { sizes[len(sizes)-1] = -1 SimpleTableSizes(data, sizes) } - footer := fmt.Sprintf("SimpleTable() len=(%d) w=(%d) sizes=(%v)", len(data), TERMSIZE, sizes) + footer := fmt.Sprintf(" SimpleTable() len=(%d) w=(%d) sizes=(%v)", len(data), TERMSIZE, sizes) return footer } @@ -71,10 +71,10 @@ func SimpleTableSizes(data [][]string, sizes []int) string { for _, parts := range data { line, fmtline := StandardTableRow(sizes, parts) _ = fmtline - fmt.Println(line) + fmt.Println(" " + line) } } - footer := fmt.Sprintf("SimpleTableSizes() len=(%d) w=(%d) sizes=(%v)", len(data), TERMSIZE, sizes) + footer := fmt.Sprintf(" SimpleTableSizes() len=(%d) w=(%d) sizes=(%v)", len(data), TERMSIZE, sizes) return footer } diff --git a/humanTable.go b/humanTable.go index 9fe164d..17b84a1 100644 --- a/humanTable.go +++ b/humanTable.go @@ -42,14 +42,15 @@ func StandardTableRow(sizes []int, args []string) (string, string) { line := strings.Join(parts, " ") var small int - if len(line) > TERMSIZE { - small = TERMSIZE + if len(line) > TERMSIZE-2 { + small = TERMSIZE - 2 } else { + small = len(line) // todo: do something else with this - small = len(line) - 3 - if small < 0 { - small = 0 - } + // small = len(line) - 3 + // if small < 0 { + // small = 0 + // } } return line[0:small], strings.Join(fmts, " ") } |
