Skip to content

Bug: Best-row (red) highlight markers land on wrong row in reversed sort mode #134

@coderabbitai

Description

@coderabbitai

Description

In the aggregate stats table (daily and monthly views), the red highlight that marks the row with the highest value in each column (cost, tokens, tool calls, etc.) lands on the incorrect row when the sort order is reversed (press r).

This is a pre-existing issue, not a regression introduced in any specific PR.

Root Cause (suspected)

The best-row indices are computed by iterating over the unfiltered/un-reversed map order, while the rows are rendered in the reversed order. Because the index computed during the best-value scan doesn't account for the reversed iteration, the highlight is applied to the wrong visual row.

Steps to Reproduce

  1. Open the TUI with sufficient daily or monthly data.
  2. Press r to reverse the sort order.
  3. Observe that the red highlight (maximum value) for each column does not correspond to the visually highest value in that column.

Related

Reported by @Sewer56.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions