From 65b53c86e4bb5f6e05b4fb1a2bd53123e0a5b791 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 21 Oct 2025 19:05:22 +0800 Subject: [PATCH] input: Hide scrollbar when not overflow in auto grow mode. (#1407) --- crates/ui/src/input/element.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/ui/src/input/element.rs b/crates/ui/src/input/element.rs index b5abf57e..bcd4f41f 100644 --- a/crates/ui/src/input/element.rs +++ b/crates/ui/src/input/element.rs @@ -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