Skip to content

fix(tui): start with first sorted issue selected instead of index 0#21

Open
euri10 wants to merge 1 commit into
Dicklesworthstone:mainfrom
euri10:scroll_top
Open

fix(tui): start with first sorted issue selected instead of index 0#21
euri10 wants to merge 1 commit into
Dicklesworthstone:mainfrom
euri10:scroll_top

Conversation

@euri10

@euri10 euri10 commented Jul 11, 2026

Copy link
Copy Markdown

The TUI was initializing with selected = 0, which refers to the first issue in the unsorted analyzer.issues vector. However, the list display renders issues in sorted order (by open status, priority, then ID). This mismatch caused the visual cursor marker (>) to appear on an issue that wasn't visually at the top of the list — typically showing the 14th issue instead of the first.

Now new_app_with_background computes the first visible issue using the same filtering and sorting logic as visible_issue_indices(), ensuring the TUI starts with the correct issue selected and visible at the top of the list.

The TUI was initializing with `selected = 0`, which refers to the first issue
in the unsorted analyzer.issues vector. However, the list display renders
issues in sorted order (by open status, priority, then ID). This mismatch
caused the visual cursor marker (>) to appear on an issue that wasn't visually
at the top of the list — typically showing the 14th issue instead of the first.

Now `new_app_with_background` computes the first visible issue using the same
filtering and sorting logic as `visible_issue_indices()`, ensuring the TUI
starts with the correct issue selected and visible at the top of the list.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 04:39

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.

Pull request overview

This PR adjusts TUI startup selection so the initially selected issue matches the first item in the sorted/visible list, eliminating the mismatch between the cursor marker and rendered ordering.

Changes:

  • Computes an initial selected value intended to match the first entry of the default-sorted list.
  • Updates new_app_with_background() to use the computed initial selection instead of hardcoding selected: 0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tui.rs
Comment on lines +14932 to +14943
let mut visible = analyzer
.issues
.iter()
.enumerate()
.filter_map(|(index, issue)| {
if issue.normalized_status().eq_ignore_ascii_case("closed") {
None
} else {
Some(index)
}
})
.collect::<Vec<_>>();
Comment thread src/tui.rs
Comment on lines +14928 to +14930
// Compute the first visible issue index using the same filtering and sorting
// logic that will be applied in visible_issue_indices(). By default, this
// filters by open status and sorts by priority, then by ID.
Comment thread src/tui.rs
Comment on lines +14965 to 14966
selected: temp_app_selected,
list_filter: ListFilter::All,
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