editor: Add support for no scroll margin in full mode (#41838)

Noticed this whilst testing the Docker debugger. I randomly scrolled the
console off screen and was confused briefly as to why this was the case.

Release Notes:

- The debugger query console will no longer needlessly overscroll.
This commit is contained in:
Finn Evers
2025-11-03 20:47:39 +01:00
committed by GitHub
parent 4da5675920
commit 08daedd014
7 changed files with 42 additions and 17 deletions
+17 -3
View File
@@ -452,6 +452,20 @@ pub enum SelectMode {
All,
}
#[derive(Copy, Clone, Default, PartialEq, Eq, Debug)]
pub enum SizingBehavior {
/// The editor will layout itself using `size_full` and will include the vertical
/// scroll margin as requested by user settings.
#[default]
Default,
/// The editor will layout itself using `size_full`, but will not have any
/// vertical overscroll.
ExcludeOverscrollMargin,
/// The editor will request a vertical size according to its content and will be
/// layouted without a vertical scroll margin.
SizeByContent,
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum EditorMode {
SingleLine,
@@ -464,8 +478,8 @@ pub enum EditorMode {
scale_ui_elements_with_buffer_font_size: bool,
/// When set to `true`, the editor will render a background for the active line.
show_active_line_background: bool,
/// When set to `true`, the editor's height will be determined by its content.
sized_by_content: bool,
/// Determines the sizing behavior for this editor
sizing_behavior: SizingBehavior,
},
Minimap {
parent: WeakEntity<Editor>,
@@ -477,7 +491,7 @@ impl EditorMode {
Self::Full {
scale_ui_elements_with_buffer_font_size: true,
show_active_line_background: true,
sized_by_content: false,
sizing_behavior: SizingBehavior::Default,
}
}