Fixed styling of the other tools

This commit is contained in:
Leon Mika 2022-06-27 16:05:59 +10:00
parent 809f9adfea
commit eadf8d1720
19 changed files with 231 additions and 105 deletions

View file

@ -48,11 +48,11 @@ type columnModel struct {
}
func (cm columnModel) Len() int {
return len(cm.m.resultSet.Columns[cm.m.colOffset:])
return len(cm.m.resultSet.Columns()[cm.m.colOffset:])
}
func (cm columnModel) Header(index int) string {
return cm.m.resultSet.Columns[cm.m.colOffset+index]
return cm.m.resultSet.Columns()[cm.m.colOffset+index]
}
func New(uiStyles styles.Styles) *Model {
@ -124,8 +124,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m *Model) setLeftmostDisplayedColumn(newCol int) {
if newCol < 0 {
m.colOffset = 0
} else if newCol >= len(m.resultSet.Columns) {
m.colOffset = len(m.resultSet.Columns) - 1
} else if newCol >= len(m.resultSet.Columns()) {
m.colOffset = len(m.resultSet.Columns()) - 1
} else {
m.colOffset = newCol
}

View file

@ -50,7 +50,7 @@ func (mtr itemTableRow) Render(w io.Writer, model table.Model, index int) {
metaInfoStyle := style.Copy().Inherit(metaInfoStyle)
sb := strings.Builder{}
for i, colName := range mtr.resultSet.Columns[mtr.model.colOffset:] {
for i, colName := range mtr.resultSet.Columns()[mtr.model.colOffset:] {
if i > 0 {
sb.WriteString(style.Render("\t"))
}