Skip to content

Commit

Permalink
fix: correct position on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Feb 27, 2025
1 parent 6f04b34 commit 3dd6b49
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,23 @@ func (m Model) handleKeys(msg tea.KeyMsg) (Model, tea.Cmd) {
log.Fatal(err)
}
m.loadHome()
m.table.MoveDown(id)

case key.Matches(msg, m.keys.RefreshAll):
prevPos := m.table.Cursor()
m.context.feeds = lib.GetAllContent(lib.UserConfig.Urls, false)
err := m.context.feeds.ReadTracking()
if err != nil {
log.Fatal(err)
}
m.loadHome()
m.table.MoveDown(prevPos)

case key.Matches(msg, m.keys.ReadAll):
prevPos := m.table.Cursor()
lib.ReadAll(m.context.feeds, m.table.Cursor())
m.loadHome()
m.table.MoveDown(prevPos)
err := m.context.feeds.WriteTracking()
if err != nil {
log.Fatalf("Could not write tracking data: %s", err)
Expand Down Expand Up @@ -167,8 +172,10 @@ func (m Model) handleKeys(msg tea.KeyMsg) (Model, tea.Cmd) {
}

case key.Matches(msg, m.keys.ReadAll):
prevPos := m.table.Cursor()
lib.ReadAll(m.context.feeds, m.context.feed.ID)
m.loadMixed()
m.table.MoveDown(prevPos)
err := m.context.feeds.WriteTracking()
if err != nil {
log.Fatalf("Could not write tracking data: %s", err)
Expand Down

0 comments on commit 3dd6b49

Please sign in to comment.