NumHeaders gets the number of columns for the current schema
()
| 26 | |
| 27 | // NumHeaders gets the number of columns for the current schema |
| 28 | func (m *TuiModel) NumHeaders() int { |
| 29 | headers := m.GetHeaders() |
| 30 | l := len(headers) |
| 31 | if m.UI.ExpandColumn > -1 || l == 0 { |
| 32 | return 1 |
| 33 | } |
| 34 | |
| 35 | maxHeaders = 7 |
| 36 | |
| 37 | if l > maxHeaders { // this just looked the best after some trial and error |
| 38 | if l%5 == 0 { |
| 39 | return 5 |
| 40 | } else if l%4 == 0 { |
| 41 | return 4 |
| 42 | } else if l%3 == 0 { |
| 43 | return 3 |
| 44 | } else { |
| 45 | return 6 // primes and shiiiii |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | return l |
| 50 | } |
| 51 | |
| 52 | // CellWidth gets the current cell width for schema |
| 53 | func (m *TuiModel) CellWidth() int { |
no test coverage detected