Skip to content

Commit 9afa318

Browse files
committed
Fix measure_value for text input in iced_wgpu
It accounts for spaces at the start of text now.
1 parent d51b501 commit 9afa318

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wgpu/src/renderer/widget/text_input.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ impl text_input::Renderer for Renderer {
2323
Size::INFINITY,
2424
);
2525

26-
let spaces_at_the_end = value.len() - value.trim_end().len();
26+
let spaces_around = value.len() - value.trim().len();
2727

28-
if spaces_at_the_end > 0 {
28+
if spaces_around > 0 {
2929
let space_width = self.text_pipeline.space_width(size as f32);
30-
width += spaces_at_the_end as f32 * space_width;
30+
width += spaces_around as f32 * space_width;
3131
}
3232

3333
width

0 commit comments

Comments
 (0)