mojira.dev

RayZ_R

Assigned

No issues.

Reported

MC-301585 You can start text selection outside of some textboxes Confirmed

Comments

[media][media][media]

The fix by @TriWonder81 resolves the bug, but it creates a new one:
When pressing F3+F4+ESC and then releasing F3, the debug menu will open, which doesn't happen without the fix. This occurs because when pressing F3+F4, this.switchF3State is set to false, but when pressing ESC to exit the screen, this.switchF3State isn't changed, which means the F3 menu will open when F3 is released.

Both the initial and the new bug can be fixed by adding setSwitchF3State method to net.minecraft.client.Keyboard.java:

public void setSwitchF3State(boolean switchF3State) {
    this.switchF3State = switchF3State; 
}

and changing switchF3State in checkForClose method of net.minecraft.client.gui.screen.GameModeSelectionScreen.java:

private boolean checkForClose() {
    if (!InputUtil.isKeyPressed(this.client.getWindow().getHandle(), GLFW.GLFW_KEY_F3)) {
        this.apply();
        this.client.setScreen(null);
        this.client.keyboard.setSwitchF3State(false); // added
        return true;
    } else {
        return false;
    }
}

so, when GameModeSelectionScreen closes by releasing F3, switchF3State is set to false, otherwise, when ESC is pressed, it is true.