Open ghost opened 8 years ago
This was discussed in #15 and the consensus there was not to enable key repeat by default. Or do you mean you set love.keyboard.setKeyRepeat(true)
and key repeat still doesn't work in text boxes for some reason?
Hmm, I see what you mean now. So when a text box takes focus, turn on key repeat, and when it loses focus, turn key repeat back off if it was off before. I guess you'd also want that for sliders, and some user-defined controls would probably want it too. Maybe we introduce a new repeat
attribute that produces that behavior, and give text and slider inputs that attribute by default.
Yes. Gspöt uses that exact approach.
Somehow it feels a little sketchy to me, since at least some of the keyboard input can affect other things besides the focused widget; in the case of a text box, anything that doesn't look like it's related to text input will propagate. I don't really like the SDL backend and Love backend having different behavior out of the box either, though. Let me think about it a bit, I think there might be other solutions that could also work (like just turning key repeat on, but trapping repeat-generated keypresses under certain conditions, maybe).
Yes, I see your point. Rather than trapping repeats, one possible solution would be to generate auto-repeats for certain keys using a timer. But it gets somewhat complicated.
Key repeat in an input control does not work for some keys, notably for backspace and arrows.
It should probably be handled by preserving the user-set state of key repeat when focus goes elsewhere.