airstruck / luigi

Lovely User Interfaces for Game Inventors
MIT License
113 stars 23 forks source link

Text input crashes on non-ASCII characters with the SDL backend #46

Closed Lukc closed 8 years ago

Lukc commented 8 years ago

Steps to reproduce:

luajit: ./luigi/widget/text.lua:340: attempt to get length of local 'key' (a nil value)
stack traceback:
        ./luigi/widget/text.lua:340: in function 'isKeyTextInput'
        ./luigi/widget/text.lua:401: in function 'func'
        ./luigi/hooker.lua:79: in function 'callbacks'
        ./luigi/event.lua:16: in function 'emit'
        ./luigi/widget.lua:288: in function 'bubbleEvent'
        ./luigi/input.lua:25: in function 'func'
        ./luigi/hooker.lua:79: in function 'keypressed'
        ./luigi/backend/ffisdl.lua:89: in function 'run'
        main.lua:108: in main chunk
        [C]: at 0x55729b56e580

I noticed I had to uncomment the Backend.run() line. I’m not sure if additional precautions should be taken when working with luigi and the SDL.

airstruck commented 8 years ago

Hmm, my keyboard doesn't have any keys like that. The SDL backend should try to do something like whatever Love does with those keys, but I'm not sure what it does. Can you check what happens in love.keypressed when you press that key in a small test project? Just something like:

function love.keypressed (...) print(...) end

Let me know what it prints out when you hit that key, if anything.

Lukc commented 8 years ago
$ love .
b       q       false
unknown w       false
p       e       false
o       r       false
unknown t       false
$ 

The first parameter seems to be the key on my actual layout, with unknowns for “strange” keys (é, è, …) and the second one the key that would be at that position on a qwerty layout.

The second line was the “é” press. The fifth was the “è” press.

airstruck commented 8 years ago

Perfect, thank you!