Title Unicode and complex key mapping
AuthorRodrigo Arias Mallo
CreatedSat, 20 Jun 2026 12:48:10 +0200
State open

There are some problems when handling key mapping in Dillo.

Additionally, for a given key code and modifier values like <Shift>X, we cannot derive the information that the shortcut was <Shift>X or that the Shift key was needed to type the "X" text.

The current workaround was to drop the modifiers when the produced text doesn't match the key code, but that doesn't work always. A problematic example is the "Numpad +" that has a key code different than "+", so when mapped with the Control modifier, it gets dropped because it assumes it was needed to produce the event text "+".

The simplest option is to only allow ASCII characters to define key codes which are guaranteed to match the event text and use the raw key code for the rest.

This will break cases like φ = home where we used to compare with the event text, but can be remapped to 0x7f6 = home relatively easy if we dump the equivalence:

pressed key: key=0x7f6, modifier=0x0, text=φ, shortcut=0x7f6
pressed key: key=0x7f6, modifier=0x10000, text=Φ, shortcut=<Shift>0x7f6
pressed key: key=0x7f6, modifier=0x40000, text=φ, shortcut=<Ctrl>0x7f6
pressed key: key=0x7f6, modifier=0x80000, text=φ, shortcut=<Alt>0x7f6

A more elaborate option may be to first look for raw key codes when matching an event and if there is no match use the event text and match it via Unicode.

However, this would still have the problem of not being able to know if a modifier is needed to arrive at the event text. We could choose to always require the user to type the modifiers and the event text, so you would write <Shift>X even if you are pressing Shift and x to produce X.

If you want to add a binding for <Ctrl>Numpad + you can use the key code so that it takes precedence over the event text.

In any case, we would need to differentiate between the two (Unicode value vs key code) in the list of key mappings.