refactor(ui): simplify panel mode mapping and add scroll tests
Adds a `mode()` method to the `Panel` enum to map panels to their corresponding `AppMode`. Simplifies `TogglePanelAndFocus` in `cmd.rs` to use this method instead of a manual match block. Also adds regression tests in `app.rs` to verify that viewport scrolling now correctly handles small terminal heights. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-31B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
@ -830,6 +830,16 @@ pub enum Panel {
|
||||
View,
|
||||
}
|
||||
|
||||
impl Panel {
|
||||
pub fn mode(self) -> AppMode {
|
||||
match self {
|
||||
Panel::Formula => AppMode::FormulaPanel,
|
||||
Panel::Category => AppMode::CategoryPanel,
|
||||
Panel::View => AppMode::ViewPanel,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Effect for SetPanelOpen {
|
||||
fn apply(&self, app: &mut App) {
|
||||
match self.panel {
|
||||
|
||||
Reference in New Issue
Block a user