love2d / love-android

Android build setup for LÖVE.
https://love2d.org
Other
211 stars 73 forks source link

Strange keyboard behavior wrapping characters in `backspace` and `space` #282

Open akkartik opened 1 week ago

akkartik commented 1 week ago

I just heard from someone for whom LÖVE 11.5's keyboard handlers are triggered unreliably. This is on a Samsung Galaxy A70 with AZERTY layout and 3 languages installed (English, French, Russian). Autocomplete is off.

The scenario

Lines = ''

function love.load() love.keyboard.setTextInput(true) local h, flags W, h, flags = love.window.getMode() flags.resizable = true love.window.setMode(W, h, flags) end

function love.resize(w, h) W = w end

function love.draw() love.graphics.printf(Lines, 10, 10, W) end

function love.keypressed(key) Lines = Lines .. 'keypress '..key..'\n' end

function love.textinput(t) Lines = Lines .. 'textinput '..t..' '..#t..' '..utf8.len(t)..'\n' end


* I then had them press the following keys on their English AZERTY keyboard: `a` `space` `b` `.` `d` `backspace` `backspace` `backspace` `backspace` `e` `space` `f` `g`.

Some of the time, particularly if they switch apps in between, they see the expected output:

keypress a textinput a 1 1 keypress space textinput 1 1 keypress b textinput b 1 1 keypress . textinput . 1 1 keypress d textinput . 1 1 keypress backspace keypress backspace keypress backspace keypress backspace keypress e textinput e 1 1 keypress space textinput 1 1 keypress f textinput f 1 1 keypress g textinput g 1 1


At other times, however, they see the following output:

keypress a textinput a 1 1 keypress space textinput 1 1 keypress b textinput b 1 1 keypress . textinput . 1 1 keypress d textinput . 1 1 keypress backspace keypress backspace keypress backspace keypress backspace keypress backspace keypress e keypress space textinput e 2 2 keypress space textinput 1 1 keypress backspace keypress f keypress space textinput f 2 2 keypress backspace keypress g keypress space textinput g 2 2



It looks like pressing `.` and `d` one after another, then some time later backspacing over a word until a space, puts the keyboard into a strange mode that wraps every non-space character with a `backspace` before and a `space` after. Have y'all ever seen anything like this? Is it perhaps some sort of feature that can be turned off on the device?

Screenshot:
![screenshot](https://github.com/user-attachments/assets/882d8422-0d6d-493c-82ea-f8dfeeec7abf)