cell editing works better

This commit is contained in:
2025-07-13 17:50:56 -07:00
parent 3fdac7d9d8
commit 76bcc8520c
4 changed files with 57 additions and 23 deletions

View File

@@ -29,7 +29,12 @@ type (
RowIndex, ColIndex int
Value string
}
ExecuteQueryMsg struct{ Query string }
ExecuteQueryMsg struct{ Query string }
QueryCompletedMsg struct {
Results [][]string
Columns []string
Error error
}
)
// Model is the main application model
@@ -506,6 +511,9 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if msg.String() == "ctrl+c" {
return m, tea.Quit
}
if msg.String() == "ctrl+z" {
return m, tea.Suspend
}
case SwitchToTableListMsg:
m.currentView = NewTableListModel(m.getSharedData())
@@ -563,6 +571,13 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.err = err
}
return m, func() tea.Msg { return SwitchToRowDetailMsg{msg.RowIndex} }
case QueryCompletedMsg:
// Forward the query completion to the query model
if queryModel, ok := m.currentView.(*QueryModel); ok {
queryModel.handleQueryCompletion(msg)
}
return m, nil
}
if m.err != nil {