Tilde key giving double characters in editor with swedish keyboard



I’m having trouble typing the tilde-character in the editor.
I’m using a swedish keyboard which means that in order to type a ‘tilde’ character I have to press AltGr + ‘tilde’, followed by the character I want after the tilde.
However, in the Defold editor I get an extra character (a kind of ").
For example, typing AltGr + ‘tilde’ and then = gives this result:


So then I have to step backwards and delete the middle character. Since Lua for some weird reason uses the ‘tilde’ character to indicate NOT in comparisons, this is rather annoying.

Is this a bug or a problem with my setup of Defold? And can I do anything about it?


I think this is a limitation in the Defold editor right now, that it doesn’t support the AltGr combination characters properly. Someone else reported a similar issue recently.

If you report it with the “Report Issue” option in the Defold editor’s help menu, then they can keep track of the issue and it is more likely to be fixed. I wouldn’t expect a really fast fix on this though.


Ok, thanks!
I figured it was something with the keyboard layout. A little ironic that my swedish layout doesn’t work, considering King is a swedish company and many of the King devs on the forum are swedish as well :stuck_out_tongue:
I guess they all use US keyboards :slight_smile:

I’m changing this to a bug.


What if you press AltGr+tilde, then space for the tilde character to show up, and then = ?

All of us in the engine and editor team :slight_smile:

No, but we all use Mac in our day to day work and on Macs the tilde character works as expected.


Macs, of course :smiley: The tilde must be the only coding related character that works better on a macbook :slight_smile: Is that why you picked Lua? jk :wink:

AltGr+Tilde followed by Space does not help. It produces ~¨ in the editor.
No other editor on my windows machine does that. Have you rolled your own keyboard input? There must be ready made solutions for this. Even in java :wink: But you had your reasons I’m sure.

There is another keyboard combination that doesn’t work properly: pressing + to zoom in the editor. I thought that was caused by my laptop layout, but maybe it’s the same reason as the tilde.

It’s not a super big deal of course. If it wasn’t for Lua using tilde for “not equal to” I wouldn’t have cared at all. (Sidenote: Why does Lua not use != like every other language? Easier to type and easier to read.)


Let’s ask @mats.gisselson tomorrow. He should know.


Hi! We don’t do anything special, we just respond to the JavaFX KeyTyped event. It is supposed to handle this stuff for us and just emit a standalone tilde character in this case. It looks a bit like we might be running into this JavaFX bug: https://bugs.openjdk.java.net/browse/JDK-8183521

The bug is still unresolved, so we’ll have to to reproduce on Windows and see if we can do something as a workaround.


Java… :wink:


Registered as DEFEDIT-1496 in our internal issue tracker.