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![] } } }