Skip to content

Regression in text_input #3411

Description

@edwloef

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

text_input treats any cursor that's in-bounds of the widget but out-of-bounds of the actual text as being at the end of that text. This is incorrect for non-left-aligned text input. Try clicking within the text_input but left of the contained text:

fn main() -> iced::Result {
    iced::run((), view)
}

fn view(_: &()) -> impl Into<iced::Element<'_, iced::Never>> {
    iced::widget::text_input("placeholder", "value")
        .width(100)
        .align_x(iced::Center)
        .on_input(|_| todo!())
}

What is the expected behavior?

Cursors that are in-bounds of the widget but left of the actual text should be treated as being at the beginning of that text.

Version

master

Operating System

Linux

Do you have any log output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions