From d251c4215c13aea104f8c524366a367b46da4b05 Mon Sep 17 00:00:00 2001 From: Anthony Date: Wed, 23 Jul 2025 11:24:30 -0400 Subject: [PATCH] Improve resize behavior --- crates/settings_ui/src/keybindings.rs | 1 - crates/settings_ui/src/ui_components/table.rs | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs index 97d9e90641..fda3d7cb0a 100644 --- a/crates/settings_ui/src/keybindings.rs +++ b/crates/settings_ui/src/keybindings.rs @@ -1436,7 +1436,6 @@ impl Render for KeymapEditor { DefiniteLength::Fraction(0.08), ]) .resizable_columns( - // todo! Resize doesn't fully work [ ResizeBehavior::None, ResizeBehavior::Resizable, diff --git a/crates/settings_ui/src/ui_components/table.rs b/crates/settings_ui/src/ui_components/table.rs index 0cb445e128..70472918d2 100644 --- a/crates/settings_ui/src/ui_components/table.rs +++ b/crates/settings_ui/src/ui_components/table.rs @@ -605,10 +605,13 @@ impl ColumnWidths { ); } else { curr_column = col_idx; - while diff_left < 0.0 && curr_column > 0 { - // todo! When resize is none and dragging to the left this doesn't work correctly - // This could be done by making min_size equal to current size if resizable is None - let Some(min_size) = resize_behavior[curr_column].min_size() else { + // Resize behavior should be improved in the future by also seeking to the right column when there's not enough space + while diff_left < 0.0 { + let Some(min_size) = resize_behavior[curr_column.saturating_sub(1)].min_size() + else { + if curr_column == 0 { + break; + } curr_column -= 1; continue; }; @@ -624,6 +627,9 @@ impl ColumnWidths { } self.widths[curr_column] = DefiniteLength::Fraction(curr_width); + if curr_column == 0 { + break; + } curr_column -= 1; }