Skip to content

Commit

Permalink
Always set focus to the results table after executing a query
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Jan 5, 2025
1 parent f90e782 commit 2404268
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions components/results_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,30 +615,19 @@ func (table *ResultsTable) subscribeToEditorChanges() {

if err != nil {
table.SetLoading(false)
App.Draw()
table.SetError(err.Error(), nil)
App.Draw()
} else {
table.UpdateRows(rows)
table.SetIsFiltering(false)

if len(rows) > 1 {
App.SetFocus(table)
table.HighlightTable()
table.Editor.SetBlur()
table.SetInputCapture(table.tableInputCapture)
App.Draw()
} else if len(rows) == 1 {
table.SetInputCapture(nil)
App.SetFocus(table.Editor)
table.Editor.Highlight()
table.RemoveHighlightTable()
table.SetIsFiltering(true)
App.Draw()
}
table.SetLoading(false)
table.SetIsFiltering(false)
table.HighlightTable()
table.Editor.SetBlur()
table.SetInputCapture(table.tableInputCapture)
table.EditorPages.SwitchToPage(pageNameTableEditorTable)
App.SetFocus(table)
App.Draw()
}
table.EditorPages.SwitchToPage(pageNameTableEditorTable)
App.Draw()
} else {
table.SetRecords([][]string{})
table.SetLoading(true)
Expand Down

0 comments on commit 2404268

Please sign in to comment.