🤖 This issue was created by Repo Assist, an automated AI assistant.
Motivation
The 7-line mode-switch sequence was duplicated verbatim in three places in handler.rs:
app.mode = (new);
app.selected = 0;
app.selected_packages.clear();
app.detail = None;
app.loading = true;
app.set_status("Loading...");
app.refresh_view();
Duplicated in:
KeyCode::Tab | KeyCode::Right handler
KeyCode::BackTab | KeyCode::Left handler
handle_tab_click (mouse tab clicks)
Any future tab source (e.g. F1/F2/F3 shortcuts) would need to copy the same block again.
Change
Added App::switch_mode(mode: AppMode) to app.rs encapsulating the above sequence. All three call-sites now reduce to:
let new_mode = app.mode.cycle();
app.switch_mode(new_mode);
```
No behaviour change.
## Test Status
All 14 existing unit tests pass. `cargo clippy` — no warnings.
```
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Click here to create the pull request
Generated by Repo Assist
Generated by Repo Assist · ◷
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64
🤖 This issue was created by Repo Assist, an automated AI assistant.
Motivation
The 7-line mode-switch sequence was duplicated verbatim in three places in
handler.rs:Duplicated in:
KeyCode::Tab | KeyCode::RighthandlerKeyCode::BackTab | KeyCode::Lefthandlerhandle_tab_click(mouse tab clicks)Any future tab source (e.g.
F1/F2/F3shortcuts) would need to copy the same block again.Change
Added
App::switch_mode(mode: AppMode)toapp.rsencapsulating the above sequence. All three call-sites now reduce to:Click here to create the pull request