Remove extraneous new lines from TUI that make the UI jump around for invalid search atoms

This commit is contained in:
David Dworken 2023-08-27 21:47:44 -07:00
parent db219f434b
commit fe41687fd0
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,5 @@
Warning: failed to search: search query contains unknown search atom 'ls' that doesn't match any column names
Search Query: > ls:
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐

View File

@ -346,13 +346,14 @@ func (m model) View() string {
}
warning := ""
if m.isOffline {
warning += "Warning: failed to contact the hishtory backend (are you offline?), so some results may be stale\n\n"
warning += "Warning: failed to contact the hishtory backend (are you offline?), so some results may be stale"
}
if m.searchErr != nil {
warning += fmt.Sprintf("Warning: failed to search: %v\n\n", m.searchErr)
warning += fmt.Sprintf("Warning: failed to search: %v", m.searchErr)
}
warning += "\n"
helpView := m.help.View(keys)
return fmt.Sprintf("\n%s\n%s%s\nSearch Query: %s\n\n%s\n", loadingMessage, warning, m.banner, m.queryInput.View(), baseStyle.Render(m.table.View())) + helpView
return fmt.Sprintf("\n%s%s%s\nSearch Query: %s\n\n%s\n", loadingMessage, warning, m.banner, m.queryInput.View(), baseStyle.Render(m.table.View())) + helpView
}
func getRows(ctx *context.Context, columnNames []string, query string, numEntries int) ([]table.Row, []*data.HistoryEntry, error) {