Skip to content

Commit 6f070f1

Browse files
CryZecmyr
authored andcommitted
Correctly clip the TextBox
By adjusting only the x component of the size before turning it into a rectangle, the right side of the rectangle gets moved, which allowed the text to peak out on the right side. Inset already seems to do what subtracting the border width there was possibly intended to do, so just using the unadjusted size and then later insetting, resolves the problem entirely.
1 parent b3bc80a commit 6f070f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

druid/src/widget/textbox.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<T: TextStorage + EditableText> Widget<T> for TextBox<T> {
576576
};
577577

578578
// Paint the background
579-
let clip_rect = Size::new(size.width - border_width, size.height)
579+
let clip_rect = size
580580
.to_rect()
581581
.inset(-border_width / 2.0)
582582
.to_rounded_rect(env.get(theme::TEXTBOX_BORDER_RADIUS));

0 commit comments

Comments
 (0)