mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
LibGUI+Apps: Prevent Splitter children from being unresizable
Splitters could be resized in such an order that all their remaining children were fixed size, leading to unfillable gaps on resize events. HackStudio and TextEditor already had logic to handle this edge case, so this patch factors it into a general solution for all Splitters. At least one widget is now guaranteed to be resizeable after a child is removed.
This commit is contained in:
committed by
Idan Horowitz
parent
c3ce562240
commit
fe864af0dc
Notes:
sideshowbarker
2024-07-17 18:21:32 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/fe864af0dc Pull-request: https://github.com/SerenityOS/serenity/pull/12681 Issue: https://github.com/SerenityOS/serenity/issues/12561 Reviewed-by: https://github.com/IdanHo ✅
@@ -693,18 +693,6 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action
|
||||
auto wrapper = m_current_editor_wrapper;
|
||||
m_switch_to_next_editor->activate();
|
||||
m_editors_splitter->remove_child(*wrapper);
|
||||
|
||||
auto child_editors = m_editors_splitter->child_widgets();
|
||||
bool has_child_to_fill_space = false;
|
||||
for (auto& editor : child_editors) {
|
||||
if (editor.max_height() == -1) {
|
||||
has_child_to_fill_space = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has_child_to_fill_space)
|
||||
child_editors.last().set_max_height(-1);
|
||||
|
||||
m_all_editor_wrappers.remove_first_matching([&wrapper](auto& entry) { return entry == wrapper.ptr(); });
|
||||
update_actions();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user