fix(tui): start with first sorted issue selected instead of index 0#21
Open
euri10 wants to merge 1 commit into
Open
fix(tui): start with first sorted issue selected instead of index 0#21euri10 wants to merge 1 commit into
euri10 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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
selectedvalue intended to match the first entry of the default-sorted list. - Updates
new_app_with_background()to use the computed initial selection instead of hardcodingselected: 0.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 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 on lines
+14965
to
14966
| selected: temp_app_selected, | ||
| list_filter: ListFilter::All, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_backgroundcomputes the first visible issue using the same filtering and sorting logic asvisible_issue_indices(), ensuring the TUI starts with the correct issue selected and visible at the top of the list.