Skip to content

Commit

Permalink
fix: keep cursor position after table update
Browse files Browse the repository at this point in the history
Change submitted upstream charmbracelet/bubbles#219
  • Loading branch information
nikaro committed Aug 20, 2022
1 parent b15abe7 commit cbe1a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vendor/github.com/charmbracelet/bubbles/table/table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions zabbixmon_tui.go
Expand Up @@ -44,7 +44,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "r":
m.prevItems = append([]zabbixmonItem(nil), m.items...)
m.items = getItems(m.zapi, config.ItemTypes, config.MinSeverity, config.Grep)
cursor := m.table.Cursor()
m.table = updateTable(m.items)
m.table.SetCursor(cursor)
m.refresh = config.Refresh
notify(m.items, m.prevItems)

Expand All @@ -58,7 +60,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.refresh <= 0 {
m.prevItems = append([]zabbixmonItem(nil), m.items...)
m.items = getItems(m.zapi, config.ItemTypes, config.MinSeverity, config.Grep)
cursor := m.table.Cursor()
m.table = updateTable(m.items)
m.table.SetCursor(cursor)
m.refresh = config.Refresh
notify(m.items, m.prevItems)
}
Expand Down

0 comments on commit cbe1a2a

Please sign in to comment.