Skip to content

Commit

Permalink
fix resize issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KarnerTh committed Dec 28, 2024
1 parent b58c471 commit cd25aa2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions internal/view/log_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type logListModel struct {
func newLogList(displayConfig config.DisplayConfig, filter observer.Publisher[string]) logListModel {
columns := make([]table.Column, len(displayConfig.Columns))
for i, v := range displayConfig.Columns {
columns[i] = table.Column{Title: v.Title}
columns[i] = table.Column{Title: v.Title, Width: 1}
}

t := table.New(
Expand Down Expand Up @@ -66,10 +66,10 @@ func (m logListModel) Init() tea.Cmd {
func (m logListModel) updateSizes(msg tea.WindowSizeMsg) logListModel {
m.width, m.height = msg.Width, msg.Height
m.table.SetWidth(m.width)
m.table.SetHeight(m.height - 5)
m.table.SetHeight(m.height - 3)
m.input.Width = m.width - 10

var cols = m.table.Columns()
cols := m.table.Columns()
for i, v := range cols {
v.Width = int(float32(m.width)*m.displayConfig.Columns[i].Width - 2)
cols[i] = v
Expand Down Expand Up @@ -174,9 +174,6 @@ func mapLogToRow(displayConfig config.DisplayConfig, log aggregator.Log) table.R

func (m logListModel) View() string {
input := inputStyle.Width(m.width - 2).Render(m.input.View())
content := contentStyle.
Width(m.width).
Render(lipgloss.JoinHorizontal(lipgloss.Bottom, m.table.View()))

content := contentStyle.Render(m.table.View())
return lipgloss.JoinVertical(lipgloss.Top, content, input)
}

0 comments on commit cd25aa2

Please sign in to comment.