input: Hide scrollbar when not overflow in auto grow mode. (#1407)

This commit is contained in:
Jason Lee 2025-10-21 19:05:22 +08:00 committed by GitHub
parent 1af28c49bd
commit 65b53c86e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -974,11 +974,16 @@ impl Element for TextElement {
last_layout.lines = Rc::new(lines);
let total_wrapped_lines = state.text_wrapper.len();
let empty_bottom_height = bounds
.size
.height
.half()
.max(BOTTOM_MARGIN_ROWS * line_height);
let empty_bottom_height = if state.mode.is_auto_grow() || state.mode.is_single_line() {
px(0.)
} else {
bounds
.size
.height
.half()
.max(BOTTOM_MARGIN_ROWS * line_height)
};
let scroll_size = size(
if longest_line_width + line_number_width + RIGHT_MARGIN > bounds.size.width {
longest_line_width + line_number_width + RIGHT_MARGIN