Skip to content

WTextBox requires clearing before replacing numbers with . or - #6766

Open

Description

@sophimoo

Describe the bug

@Override
public boolean onCharTyped(CharacterEvent input) {
if (!focused) return false;
if (filter.filter(text, input.codepoint())) {
clearSelection();
text = text.substring(0, cursor) + input.codepointAsString() + text.substring(cursor);
cursor++;
resetSelection();
runAction();
return true;
}
return false;
}

clearselection is gated on the filter check to input a new value like .5 or -5

Not sure if this is intentional, as I find it kind of annoying, although moving clearselection before would clear the field even if a rejected character was typed

Steps to reproduce

find a decimal number field showing 1.50
select the entire value with ctrl+a
type . to begin entering .25
1.50 stays selected

Tested on 1.21.11 but i see no reason why it would change in the newer version

Meteor Version

1.21.11

Minecraft Version

1.21.11

Operating System

Linux

Before submitting a bug report

  • This bug wasn't already reported (I have searched bug reports on GitHub).

  • This is a valid bug (I am able to reproduce this on the latest dev build).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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