File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed
src/main/kotlin/com/lambda Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import com.lambda.event.Event
2222import com.lambda.util.KeyCode
2323import org.lwjgl.glfw.GLFW.GLFW_PRESS
2424import org.lwjgl.glfw.GLFW.GLFW_RELEASE
25+ import org.lwjgl.glfw.GLFW.GLFW_REPEAT
2526
2627sealed class KeyboardEvent {
2728 /* *
@@ -48,6 +49,7 @@ sealed class KeyboardEvent {
4849
4950 val isPressed = action >= GLFW_PRESS
5051 val isReleased = action == GLFW_RELEASE
52+ val isRepeated = action == GLFW_REPEAT
5153
5254 fun satisfies (bind : Bind ) = bind.key == translated.code && bind.modifiers and modifiers == bind.modifiers
5355 }
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ import imgui.flag.ImGuiStyleVar
4040import imgui.flag.ImGuiWindowFlags
4141import imgui.type.ImString
4242import net.minecraft.client.gui.screen.ChatScreen
43- import org.lwjgl.glfw.GLFW
4443import kotlin.math.max
4544
4645// ToDo: Add support for searching of menu bar entries
@@ -304,7 +303,7 @@ object QuickSearch {
304303 }
305304
306305 private fun handleKeyPress (event : KeyboardEvent .Press ) {
307- if ((! event.isPressed || event.action == GLFW . GLFW_REPEAT ) ||
306+ if ((! event.isPressed || event.isRepeated ) ||
308307 ! (event.keyCode == KeyCode .LeftShift .code || event.keyCode == KeyCode .RightShift .code)) return
309308
310309 val currentTime = System .currentTimeMillis()
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ abstract class Module(
142142 || Lambda .mc.currentScreen != null
143143 || ! event.satisfies(keybind)) return @listen
144144
145- if (event.isPressed) toggle()
145+ if (event.isPressed && ! event.isRepeated ) toggle()
146146 else if (event.isReleased && disableOnRelease) disable()
147147 }
148148
You can’t perform that action at this time.
0 commit comments