update size based on screen

This commit is contained in:
2025-07-13 21:12:21 -07:00
parent 491416a575
commit 7032659d07
2 changed files with 25 additions and 6 deletions

View File

@@ -588,11 +588,23 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.width = msg.Width m.width = msg.Width
m.height = msg.Height m.height = msg.Height
// Update current view with new dimensions // Update current view with new dimensions
if tableList, ok := m.currentView.(*TableListModel); ok { switch v := m.currentView.(type) {
tableList.Shared.Width = m.width case *TableListModel:
tableList.Shared.Height = m.height v.Shared.Width = m.width
v.Shared.Height = m.height
case *TableDataModel:
v.Shared.Width = m.width
v.Shared.Height = m.height
case *RowDetailModel:
v.Shared.Width = m.width
v.Shared.Height = m.height
case *EditCellModel:
v.Shared.Width = m.width
v.Shared.Height = m.height
case *QueryModel:
v.Shared.Width = m.width
v.Shared.Height = m.height
} }
// Add similar updates for other model types as needed
case tea.KeyMsg: case tea.KeyMsg:
switch { switch {

View File

@@ -165,9 +165,16 @@ func (m *RowDetailModel) View() string {
} }
value := row[i] value := row[i]
if len(value) > 50 { // Calculate available width for value display
// Account for column name, ": ", and indentation
availableWidth := m.Shared.Width - len(col) - 4 // 4 for ": " and "> " prefix
if availableWidth < 20 {
availableWidth = 20 // Minimum width
}
if len(value) > availableWidth {
// Wrap long values // Wrap long values
lines := WrapText(value, 50) lines := WrapText(value, availableWidth)
value = strings.Join(lines, "\n ") value = strings.Join(lines, "\n ")
} }