You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 This is an automated pull request from Repo Assist.
Summary
Left-click and right-click on the package list both contained an identical row-to-index calculation and detail-load sequence. This PR extracts it into a single select_package_at_row helper, eliminating the duplication.
Changes
New private select_package_at_row(app, row) function in handler.rs.
Left-click handler reduced to one call site.
Right-click handler reduced to one call site.
Minor comment cleanup (removed stale "Double-click" comment on right-click arm).
Why
Duplicate code is a maintenance hazard: any future fix (e.g. adjusting the scroll offset arithmetic) must be applied in two places. With the helper, it's one place.
No behaviour change.
Test Status
Infrastructure limitation: this project targets windows-latest runners and cannot be built/tested in the current Linux environment. The change is a pure refactor — no logic has been altered — and the diff has been reviewed by inspection. CI will validate it on Windows.
gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/improve-mouse-selection-dedup-38d3e3df7f2fe625.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests.
Show patch preview (81 of 81 lines)
From c8ed4e78f1a802b81934cc9513139fe7f10b5d57 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 17 Mar 2026 06:20:42 +0000
Subject: [PATCH] refactor: extract duplicate mouse row-selection into helper
Left-click and right-click on the package list both ran the same
row-to-index calculation and detail-load logic verbatim. Extract
it into a `select_package_at_row` helper to eliminate the
duplication and make each call site a single line.
No behaviour change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
src/handler.rs | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/handler.rs b/src/handler.rs
index 3f74409..a048939 100644
--- a/src/handler.rs+++ b/src/handler.rs@@ -262,6 +262,18 @@ fn load_detail_for_selected(app: &mut App) {
}
}
+/// Select the package row at the given terminal row coordinate and load its detail.+fn select_package_at_row(app: &mut App, row: u16) {+ let content_y = app.layout.list_content_y;+ if row >= content_y {+ let clicked_idx = (row - content_y) as usize + app.table_scroll_offset;+ if clicked_idx < app.filtered_packages.len() {+ app.selected = clicked_idx;+ load_detail_for_selected(app);+ }+ }+}+
fn handle_mouse(
app: &mut App,
mouse: crossterm::event::MouseEvent,
@@ -315,14 +327,7 @@ fn handle_mouse(
return Ok(false);
}
- let content_y = app.layout.list_content_y;- if row >= content_y {- let clicked_idx = (row - content_y) as usize + app.table_scroll_offset;- if clicked_idx < app.filtered_packages.len() {- app.selected = clicked_idx;- load_detail_for_selected(app);- }- }+ select_package_at_row(app, row);
... (truncated)
🤖 This is an automated pull request from Repo Assist.
Summary
Left-click and right-click on the package list both contained an identical row-to-index calculation and detail-load sequence. This PR extracts it into a single
select_package_at_rowhelper, eliminating the duplication.Changes
select_package_at_row(app, row)function inhandler.rs.Why
Duplicate code is a maintenance hazard: any future fix (e.g. adjusting the scroll offset arithmetic) must be applied in two places. With the helper, it's one place.
No behaviour change.
Test Status
Infrastructure limitation: this project targets
windows-latestrunners and cannot be built/tested in the current Linux environment. The change is a pure refactor — no logic has been altered — and the diff has been reviewed by inspection. CI will validate it on Windows.Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
repo-assist/improve-mouse-selection-dedup-38d3e3df7f2fe625.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests.
Show patch preview (81 of 81 lines)