feat(wm): remove scrolling layout column fallbacks

This commit removes the fallback to the columns layout when the number
of columns on the scrolling layout is less than 3.
This commit is contained in:
LGUG2Z
2025-10-13 14:56:32 -07:00
parent a77b3e774a
commit df2adde13d
+6 -34
View File
@@ -52,31 +52,6 @@ impl Arrangement for DefaultLayout {
let column_width = area.right / column_count as i32; let column_width = area.right / column_count as i32;
let mut layouts = Vec::with_capacity(len); let mut layouts = Vec::with_capacity(len);
match len {
// treat < 3 windows the same as the columns layout
len if len < 3 => {
layouts = columns(area, len);
let adjustment = calculate_columns_adjustment(resize_dimensions);
layouts.iter_mut().zip(adjustment.iter()).for_each(
|(layout, adjustment)| {
layout.top += adjustment.top;
layout.bottom += adjustment.bottom;
layout.left += adjustment.left;
layout.right += adjustment.right;
},
);
if matches!(
layout_flip,
Some(Axis::Horizontal | Axis::HorizontalAndVertical)
) && let 2.. = len
{
columns_reverse(&mut layouts);
}
}
// treat >= column_count as scrolling
len => {
let visible_columns = area.right / column_width; let visible_columns = area.right / column_width;
let keep_centered = layout_options let keep_centered = layout_options
.and_then(|o| { .and_then(|o| {
@@ -115,9 +90,7 @@ impl Arrangement for DefaultLayout {
if focused_idx < previous_first_visible { if focused_idx < previous_first_visible {
// focused window is off the left edge, we need to scroll left // focused window is off the left edge, we need to scroll left
focused_idx focused_idx
} else if focused_idx } else if focused_idx >= previous_first_visible + visible_columns as isize {
>= previous_first_visible + visible_columns as isize
{
// focused window is off the right edge, we need to scroll right // focused window is off the right edge, we need to scroll right
// and make sure it's the last visible window // and make sure it's the last visible window
(focused_idx + 1 - visible_columns as isize).max(0) (focused_idx + 1 - visible_columns as isize).max(0)
@@ -146,16 +119,15 @@ impl Arrangement for DefaultLayout {
} }
let adjustment = calculate_scrolling_adjustment(resize_dimensions); let adjustment = calculate_scrolling_adjustment(resize_dimensions);
layouts.iter_mut().zip(adjustment.iter()).for_each( layouts
|(layout, adjustment)| { .iter_mut()
.zip(adjustment.iter())
.for_each(|(layout, adjustment)| {
layout.top += adjustment.top; layout.top += adjustment.top;
layout.bottom += adjustment.bottom; layout.bottom += adjustment.bottom;
layout.left += adjustment.left; layout.left += adjustment.left;
layout.right += adjustment.right; layout.right += adjustment.right;
}, });
);
}
}
layouts layouts
} }