2009/8/27 Andreas Raab andreas.raab@gmx.de
Michal Perutka wrote:
UnicodeInputInterpreter>>nextCharFrom: sensor firstEvt: evtBuf "Compose Unicode character sequences" | peekEvent keyValue composed | "Only try this if the first event is composable and is a character event" ((Unicode isComposable: (keyValue := evtBuf *sixth*)) and:[evtBuf fourth = EventKeyChar]) ifTrue:[ ... ]. "XXXX: Fixme. We should put the skipped event back if we haven't consumed it."
^ *Unicode* value: keyValue
Why evtBuf sixth ? Some keys on a Czech keyboard give me possibility to type Czech characters with diacritical marks directly. Correct codes (unicodes, e.g. 353 for $š) I've found in evtBuf at the sixth position, not at the third. And the sixth position seems to be Ok for all characters.
Yes, that's correct. Mistake on my part. Element three is the old MacRoman value; number six is the UTF32 code point.
Using evtBuf sixth throughout the method brought me problems with ctrl-c, ctrl-s, etc. and even scrolling by a mouse wheel stopped working. This modification seems to fix them:
UnicodeInputInterpreter>>nextCharFrom: sensor firstEvt: evtBuf "Compose Unicode character sequences" "Only try this if the first event is composable and is a character event" | peekEvent keyValue composed | keyValue := evtBuf sixth > 127 ifTrue: [evtBuf sixth] ifFalse: [evtBuf third]. ((Unicode isComposable: keyValue) and: [evtBuf fourth = EventKeyChar]) ifTrue: [ ...
Cheers Michal
squeak-dev@lists.squeakfoundation.org