diff options
| author | Duncan Overbruck <mail@duncano.de> | 2025-03-13 03:09:06 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-14 12:57:33 -0700 |
| commit | f6aa8c17937fadd1da3c8f2f080ea402ae17da87 (patch) | |
| tree | 8a4ca8f238c98a238e86b8c5331e33e414547601 /src/layout/scrolling.rs | |
| parent | a5d58d670bde166ff8bca8a83bb6f1136c7fa67b (diff) | |
| download | niri-f6aa8c17937fadd1da3c8f2f080ea402ae17da87.tar.gz niri-f6aa8c17937fadd1da3c8f2f080ea402ae17da87.tar.bz2 niri-f6aa8c17937fadd1da3c8f2f080ea402ae17da87.zip | |
Add move-column-to-index action
Diffstat (limited to 'src/layout/scrolling.rs')
| -rw-r--r-- | src/layout/scrolling.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<W: LayoutElement> ScrollingSpace<W> { 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; |
