Skip to content

fix: next and prev in the article view follow the filtered list - #204

Open
thebanri wants to merge 1 commit into
guyfedwards:masterfrom
thebanri:fix-next-prev-filter
Open

thebanri wants to merge 1 commit into
guyfedwards:masterfrom
thebanri:fix-next-prev-filter

Conversation

@thebanri

@thebanri thebanri commented Oct 4, 2026

Copy link
Copy Markdown

Following up on #201: this is one of the fixes from it, on Bubble Tea.

With a filter applied, l/h in the article view open the wrong article. list.Index() counts the filtered rows, but next and prev indexed list.Items(), which is every row. Filter to two articles with another one between them in the full list, and next opens the one in between.

Switching to VisibleItems() isn't enough on its own. Opening an article calls UpdateList, and a filtered list then refilters in the background. The FilterMatchesMsg arrived while the article view was showing, so it went to the viewport and was dropped. In the article view the list had no visible rows, and next and prev did nothing. Update now hands FilterMatchesMsg to the list whichever view is showing.

Before / after, with three articles where the filter golang shows two:

open "golang two", press l   master: "rust news"   this PR: "golang one"
then press h                 master: "golang two"  this PR: "golang two"

Checked by running nom in a pty against a local feed, and with TestNextAndPrevFollowTheFilteredList. The test drives the model through Update the way the program does: it types the filter, opens an article, presses l and h, and runs the commands they return. It fails on master, and it also fails with only the VisibleItems() half of the change.

Not changed here: m (mark read) in the article view still takes its undo backup from list.Items() by the filtered index. It has the same mix-up, but fixing it touches bubbles' RemoveItem/InsertItem, which are themselves unfiltered-index based, so I left it for a separate change.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 22:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants