feat(command): implement help page navigation
Implement help page navigation with `help-page-next` and `help-page-prev` commands. - Added `HelpPageNextCmd` and `HelpPagePrevCmd` to `src/command/cmd.rs` . - Registered help navigation commands in `CmdRegistry` . - Updated `HelpCmd` to initialize the help page. - Added unit tests for help navigation in `src/ui/app.rs` . Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
@ -892,3 +892,42 @@ pub fn change_mode(mode: AppMode) -> Box<dyn Effect> {
|
||||
pub fn set_selected(row: usize, col: usize) -> Box<dyn Effect> {
|
||||
Box::new(SetSelected(row, col))
|
||||
}
|
||||
|
||||
// ── Help page navigation ────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HelpPageNext;
|
||||
impl Effect for HelpPageNext {
|
||||
fn apply(&self, app: &mut App) {
|
||||
let max = crate::ui::help::HELP_PAGE_COUNT.saturating_sub(1);
|
||||
app.help_page = app.help_page.saturating_add(1).min(max);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HelpPagePrev;
|
||||
impl Effect for HelpPagePrev {
|
||||
fn apply(&self, app: &mut App) {
|
||||
app.help_page = app.help_page.saturating_sub(1);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HelpPageSet(pub usize);
|
||||
impl Effect for HelpPageSet {
|
||||
fn apply(&self, app: &mut App) {
|
||||
app.help_page = self.0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn help_page_next() -> Box<dyn Effect> {
|
||||
Box::new(HelpPageNext)
|
||||
}
|
||||
|
||||
pub fn help_page_prev() -> Box<dyn Effect> {
|
||||
Box::new(HelpPagePrev)
|
||||
}
|
||||
|
||||
pub fn help_page_set(page: usize) -> Box<dyn Effect> {
|
||||
Box::new(HelpPageSet(page))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user