rlopez1j / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

mkKeymap (hence additionalKeysP) doesn't handle NLS characters #554

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to use a national language character such as ù in a keybinding with 
`additionalKeysP`
2. Observe that the keybinding doesn't work

What is the expected output? What do you see instead?

If you dump the resulting key bindings from the XConfig, the key is not present 
at all, even in a mangled form

The following code is part of XMonad.Util.EZConfig:

    -- | Parse an unmodified basic key, like @\"x\"@, @\"<F1>\"@, etc.
    parseKey :: ReadP KeySym
    parseKey = parseRegular +++ parseSpecial

    -- | Parse a regular key name (represented by itself).
    parseRegular :: ReadP KeySym
    parseRegular = choice [ char s >> return k
                          | (s,k) <- zip ['!'..'~'] [xK_exclam..xK_asciitilde]
                          ]

    -- | Parse a special key name (one enclosed in angle brackets).
    parseSpecial :: ReadP KeySym
    parseSpecial = do _   <- char '<'
                      key <- choice [ string name >> return k
                                    | (name,k) <- keyNames
                                    ]
                      _   <- char '>'
                      return key

Note that the only options here are literal characters in the range '!' through 
'~', or specific named sequences. Neither NLS characters outside the /[!-~]/ 
range nor hex keysyms of the form supported by many Xlib-based mechanisms and 
widely used for Unicode symbols are supported.

Original issue reported on code.google.com by allber...@gmail.com on 17 Aug 2013 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by allber...@gmail.com on 17 Aug 2013 at 10:07

GoogleCodeExporter commented 9 years ago
Hmm, you're right, this ought to be fixed.  What's the right way to do it?  I 
am not sure how X11 keysyms are supposed to work.  Can they just be arbitrary 
Unicode codepoints? (I don't even know if that question typechecks.)

Original comment by byor...@gmail.com on 3 Sep 2013 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by byor...@gmail.com on 3 Sep 2013 at 4:12

GoogleCodeExporter commented 9 years ago
There's going to have to be a table somewhere, since the codes for characters 
outside the range \x20-\x7e aren't synched to Unicode (and in fact predate 
Unicode, and even ISO 8859-1).

The good news is that, at least with X.Org, the comments for the keysyms 
include the Unicode code points as U+xxxx. The bad news is that X11 puts 
various extension keysyms in FD00-FFFF, which may potentially collide with 
Unicode codepoints. I don't know that we care much about these, though; they're 
largely special forms, e.g. FC00-FDFF is Arabic Presentation Forms-A and 
FF00-FFFF is CJK Half-width and Full-width Characters.

See /usr/include/X11/keysymdef.h on Linux / *BSD (or equivalents elsewhere, 
e.g. /opt/X11/include/X11/keysymdef for XQuartz on OS X).

Original comment by allber...@gmail.com on 4 Sep 2013 at 2:16