From f6aa8c17937fadd1da3c8f2f080ea402ae17da87 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Thu, 13 Mar 2025 03:09:06 +0100 Subject: Add move-column-to-index action --- src/layout/scrolling.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/layout/scrolling.rs') diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index cad65881..8659b8f8 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -1583,6 +1583,14 @@ impl ScrollingSpace { self.columns[self.active_column_idx].focus_bottom() } + pub fn move_column_to_index(&mut self, index: usize) { + if self.columns.is_empty() { + return; + } + + self.move_column_to(index.saturating_sub(1).min(self.columns.len() - 1)); + } + fn move_column_to(&mut self, new_idx: usize) { if self.active_column_idx == new_idx { return; -- cgit