Just Enough Items (JEI)

Just Enough Items (JEI)

392M Downloads

Switching filter text field in item overlay focused an unfocused makes repeated keyboard event in GUI invalid

Towdium opened this issue ยท 2 comments

commented

Here is an easy way to produce the issue:

  1. Open creative inventory
  2. Focus on the filter text field
  3. Click the search text field in creative inventory
  4. Type something
  5. Keep backspace pressed
  6. Only one character get deleted

After following the execusion of code for a while, I found something might be the reason:

When clicking the text field, it first calls this function to set it focused, without calling GuiTextFieldFilter.setFocused:

setFocused:238, Widget (net.minecraft.client.gui.widget)
setFocused2:417, TextFieldWidget (net.minecraft.client.gui.widget)
mouseClicked:395, TextFieldWidget (net.minecraft.client.gui.widget)
access$201:25, GuiTextFieldFilter (mezz.jei.input)
handleClick:190, GuiTextFieldFilter$MouseHandler (mezz.jei.input)
handleSearchClick:264, IngredientListOverlay (mezz.jei.gui.overlay)
handleMouseClickedInternal:251, IngredientListOverlay (mezz.jei.gui.overlay)
access$100:38, IngredientListOverlay (mezz.jei.gui.overlay)
handleClick:439, IngredientListOverlay$MouseHandler (mezz.jei.gui.overlay)
handleClick:49, CombinedMouseHandler (mezz.jei.input)
onGuiMouseEvent:153, InputHandler (mezz.jei.input)
... ...

Afterwards, it calls GuiTextFieldFilter.setFocused, where previousKeyboardRepeatEnabled flag should be acquired and set. But at this moment, TextFieldWidget.focused flag is already set, so this step to previousKeyboardRepeatEnabled is skipped, leaving the value unchanged and usually false. Here is the stacktrace:

setFocused:123, GuiTextFieldFilter (mezz.jei.input)
setKeyboardFocus:326, IngredientListOverlay (mezz.jei.gui.overlay)
access$200:38, IngredientListOverlay (mezz.jei.gui.overlay)
handleClick:441, IngredientListOverlay$MouseHandler (mezz.jei.gui.overlay)
handleClick:49, CombinedMouseHandler (mezz.jei.input)
onGuiMouseEvent:153, InputHandler (mezz.jei.input)
... ...

When the search text field loses focus, it will set keyboardListener.repeatEventsEnabled flag back to false, making repeated keyboard event in GUI not received.

commented

This has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

commented

Thanks for the report!
Sorry I missed this issue entirely. Input handling has changed a lot in the latest versions of JEI (1.18+), can you confirm if this issue is still present?