From a3d8adfb4509101e00703949b53cd94ea708069d Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Wed, 8 Apr 2026 22:27:37 -0700 Subject: [PATCH] refactor(command): improve axis operation feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve feedback for axis operations: - `CycleAxisAtCursor` : Now provides a status message if no category is at the cursor. - `TileAxisOp` : - Now provides a status message showing the new axis (e.g., "Category → Row"). - No longer automatically switches to `AppMode::Normal` , allowing for multiple consecutive adjustments. - Provides a status message if no category is at the cursor. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL) --- src/command/cmd.rs | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/command/cmd.rs b/src/command/cmd.rs index 34beedd..d85968f 100644 --- a/src/command/cmd.rs +++ b/src/command/cmd.rs @@ -1288,7 +1288,9 @@ impl Cmd for CycleAxisAtCursor { if let Some(cat_name) = ctx.cat_at_cursor() { vec![Box::new(effect::CycleAxis(cat_name))] } else { - vec![] + vec![effect::set_status( + "Move cursor to a category header to change axis".to_string(), + )] } } } @@ -1552,12 +1554,23 @@ impl Cmd for MoveTileCursor { } } -/// Cycle or set the axis for the category at the tile cursor, then return to Normal. +/// Cycle or set the axis for the category at the tile cursor. +/// Stays in TileSelect mode so the user can adjust multiple tiles. /// `axis: None` → cycle, `axis: Some(a)` → set to `a`. #[derive(Debug)] pub struct TileAxisOp { pub axis: Option, } + +fn axis_label(axis: Axis) -> &'static str { + match axis { + Axis::Row => "Row", + Axis::Column => "Col", + Axis::Page => "Page", + Axis::None => "None", + } +} + impl Cmd for TileAxisOp { fn name(&self) -> &'static str { if self.axis.is_some() { @@ -1569,6 +1582,18 @@ impl Cmd for TileAxisOp { fn execute(&self, ctx: &CmdContext) -> Vec> { let cat_names = ctx.model.category_names(); if let Some(name) = cat_names.get(ctx.tile_cat_idx) { + let new_axis = match self.axis { + Some(axis) => axis, + None => { + let current = ctx.model.active_view().axis_of(name); + match current { + Axis::Row => Axis::Column, + Axis::Column => Axis::Page, + Axis::Page => Axis::None, + Axis::None => Axis::Row, + } + } + }; let axis_effect: Box = match self.axis { Some(axis) => Box::new(effect::SetAxis { category: name.to_string(), @@ -1576,13 +1601,10 @@ impl Cmd for TileAxisOp { }), None => Box::new(effect::CycleAxis(name.to_string())), }; - vec![ - axis_effect, - effect::mark_dirty(), - effect::change_mode(AppMode::Normal), - ] + let status = format!("{} → {}", name, axis_label(new_axis)); + vec![axis_effect, effect::mark_dirty(), effect::set_status(status)] } else { - vec![effect::change_mode(AppMode::Normal)] + vec![] } } }