From 8c416bea4d0f7665ad9dadd7a078c8460b44b87c Mon Sep 17 00:00:00 2001 From: sedax90 <5001801+sedax90@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:33:41 +0100 Subject: [PATCH 1/3] fix(linux-editor): keep the query in view when the results are dragged up --- linux/crates/app/src/ui/editor/tests.rs | 14 ++++++++++++++ linux/data/resources/ui/sql-editor.ui | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/linux/crates/app/src/ui/editor/tests.rs b/linux/crates/app/src/ui/editor/tests.rs index ce7c335ef7..65286997d6 100644 --- a/linux/crates/app/src/ui/editor/tests.rs +++ b/linux/crates/app/src/ui/editor/tests.rs @@ -3317,3 +3317,17 @@ mod result_edits { assert_eq!(tracker.pending_count(), 0); } } + +/// Dragging the results up stops at the editor's few lines: neither side +/// of the divider shrinks below its minimum, so the query never goes. +#[gtk4::test] +fn the_divider_keeps_the_editor_in_view() { + let harness = editor_with(Replies::default(), "SELECT 1"); + let paned = crate::test_support::descendants(&harness.editor) + .into_iter() + .find_map(|widget| widget.downcast::().ok()) + .expect("the divider between the query and its results"); + + assert!(!paned.shrinks_start_child(), "the editor can be dragged out of view"); + assert!(!paned.shrinks_end_child(), "the results can be dragged out of view"); +} diff --git a/linux/data/resources/ui/sql-editor.ui b/linux/data/resources/ui/sql-editor.ui index 8e497c885c..d89f3750ee 100644 --- a/linux/data/resources/ui/sql-editor.ui +++ b/linux/data/resources/ui/sql-editor.ui @@ -199,13 +199,17 @@ 280 true true + + false false false - 200 + 120 true From 3879369e94cb87df2d81b9b38a7b3620c542baf6 Mon Sep 17 00:00:00 2001 From: sedax90 <5001801+sedax90@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:34:36 +0100 Subject: [PATCH 2/3] docs(linux-editor): add the changelog entry --- linux/changelog.d/4120.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 linux/changelog.d/4120.fixed.md diff --git a/linux/changelog.d/4120.fixed.md b/linux/changelog.d/4120.fixed.md new file mode 100644 index 0000000000..5aac9ecd3f --- /dev/null +++ b/linux/changelog.d/4120.fixed.md @@ -0,0 +1 @@ +Dragging the results up no longer hides the query: the editor keeps a few lines. From c71c0e0204cc940648b40c8d531e6c2196a53d67 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 8 Nov 2026 23:48:49 +0700 Subject: [PATCH 3/3] test(linux-editor): verify divider limits in allocated windows --- linux/crates/app/src/ui/editor/tests.rs | 41 ++++++++++++++++++++++--- linux/data/resources/ui/sql-editor.ui | 5 ++- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/linux/crates/app/src/ui/editor/tests.rs b/linux/crates/app/src/ui/editor/tests.rs index 65286997d6..05dd819d12 100644 --- a/linux/crates/app/src/ui/editor/tests.rs +++ b/linux/crates/app/src/ui/editor/tests.rs @@ -3318,16 +3318,49 @@ mod result_edits { } } -/// Dragging the results up stops at the editor's few lines: neither side -/// of the divider shrinks below its minimum, so the query never goes. #[gtk4::test] fn the_divider_keeps_the_editor_in_view() { let harness = editor_with(Replies::default(), "SELECT 1"); + let window = crate::test_support::OwnedWindow::presented( + gtk4::Window::builder() + .default_width(800) + .default_height(600) + .child(&harness.editor) + .build(), + ); let paned = crate::test_support::descendants(&harness.editor) .into_iter() .find_map(|widget| widget.downcast::().ok()) .expect("the divider between the query and its results"); + let editor = paned.start_child().expect("the editor pane"); + let results = paned.end_child().expect("the results pane"); + wait_until(WAIT, || paned.height() > 0).expect("the editor is allocated"); + + for text in ["SELECT 1".to_owned(), "SELECT 1;\n".repeat(300)] { + harness.editor.buffer().set_text(&text); + paned.set_position(0); + wait_until(WAIT, || paned.position() > 0).expect("the divider stops above the editor minimum"); + let minimum = editor.measure(gtk4::Orientation::Vertical, paned.width()).0; + assert!(minimum >= 120); + assert!(editor.height() >= minimum); + assert!(harness.editor.imp().source_view.height() >= 120); + + let bottom = paned.height(); + paned.set_position(bottom); + wait_until(WAIT, || paned.position() < bottom).expect("the results retain their minimum"); + assert!(results.height() >= results.measure(gtk4::Orientation::Vertical, paned.width()).0); + assert!(editor.height() >= minimum); + + let middle = paned.height() / 2; + paned.set_position(middle); + wait_until(WAIT, || editor.height() > minimum && results.height() > 0) + .expect("the divider can still move between its limits"); + } - assert!(!paned.shrinks_start_child(), "the editor can be dragged out of view"); - assert!(!paned.shrinks_end_child(), "the results can be dragged out of view"); + window.set_default_size(800, 400); + wait_until(WAIT, || window.height() < 600).expect("the window becomes shorter"); + paned.set_position(0); + wait_until(WAIT, || paned.position() > 0).expect("a short window keeps the editor visible"); + assert!(harness.editor.imp().source_view.height() >= 120); + assert!(results.height() > 0); } diff --git a/linux/data/resources/ui/sql-editor.ui b/linux/data/resources/ui/sql-editor.ui index d89f3750ee..1a5fb69551 100644 --- a/linux/data/resources/ui/sql-editor.ui +++ b/linux/data/resources/ui/sql-editor.ui @@ -199,9 +199,8 @@ 280 true true - + false false