diff options
| author | Jeff Carr <[email protected]> | 2025-10-26 13:47:33 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-26 13:47:33 -0500 |
| commit | 57fa0dc00c8141c252c8ec452f8a34448315c33d (patch) | |
| tree | 41dde96310110fff95adcb7ac7b17b031dcae0ac | |
| parent | d7ee602d7352943d12e8588623a364c1bf2214ed (diff) | |
leave 1 char on each sidev0.0.32
| -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, " ") } |
