The shiftEnclose: horror show

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

The shiftEnclose: horror show

Nicolas Cellier
I'm typing this message on a mac French keyboard.
That means I can obtain the holy brackets [ | ] only through weird
keystroke combinations
| = shit+option+L
[ = shift+option+( where shift+5 is (

Enclosing a text in square brackets would require some finger torture
both in Squeak/Pharo
shift+option+command+(
But this does not work because of #shiftEnclose: rules encountered in
#initializeShiftCmdKeyShortcuts
(found both ParagraphEditor class and TextEditor class)

        "Note: Command key overrides shift key, so, for example, cmd-shift-9
produces $9 not $("
        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
#shiftEnclose: ]. "({< and double-quote"
        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
Mac FKey command."

shiftEnclose: is badly designed because it does hardcode the keyboard
layout (see below).
This is not compatible with modern VMs, at least the mac ones, because
they deliver a unicode codePoint for $[ or $|, not a raw keycode.
It's easy to remove this anachronism and correct the mapping:

        "On some keyboards, these characters require a shift"
        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].

To avoid pushing a mac-centric change in trunk, I need to know if the
Linux/Windows VM would support above modification.
Can anyone check for me ?

Nicolas





Example of hardcoded keyboard layout:
TextEditor>>shiftEnclose: aKeyboardEvent
        "Insert or remove bracket characters around the current selection.
         Flushes typeahead."

        | char left right startIndex stopIndex oldSelection which text |
        char := aKeyboardEvent keyCharacter.
        char = $9 ifTrue: [ char := $( ].
        char = $, ifTrue: [ char := $< ].
        char = $[ ifTrue: [ char := ${ ].
        char = $' ifTrue: [ char := $" ].
        char asciiValue = 27 ifTrue: [ char := ${ ]. "ctrl-["
snip...

Reply | Threaded
Open this post in threaded view
|

Re: The shiftEnclose: horror show

Nicolas Cellier
http://code.google.com/p/pharo/issues/detail?id=4599

2011/8/4 Nicolas Cellier <[hidden email]>:

> I'm typing this message on a mac French keyboard.
> That means I can obtain the holy brackets [ | ] only through weird
> keystroke combinations
> | = shit+option+L
> [ = shift+option+( where shift+5 is (
>
> Enclosing a text in square brackets would require some finger torture
> both in Squeak/Pharo
> shift+option+command+(
> But this does not work because of #shiftEnclose: rules encountered in
> #initializeShiftCmdKeyShortcuts
> (found both ParagraphEditor class and TextEditor class)
>
>        "Note: Command key overrides shift key, so, for example, cmd-shift-9
> produces $9 not $("
>        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
> #shiftEnclose: ].       "({< and double-quote"
>        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
> Mac FKey command."
>
> shiftEnclose: is badly designed because it does hardcode the keyboard
> layout (see below).
> This is not compatible with modern VMs, at least the mac ones, because
> they deliver a unicode codePoint for $[ or $|, not a raw keycode.
> It's easy to remove this anachronism and correct the mapping:
>
>        "On some keyboards, these characters require a shift"
>        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
>
> To avoid pushing a mac-centric change in trunk, I need to know if the
> Linux/Windows VM would support above modification.
> Can anyone check for me ?
>
> Nicolas
>
>
>
>
>
> Example of hardcoded keyboard layout:
> TextEditor>>shiftEnclose: aKeyboardEvent
>        "Insert or remove bracket characters around the current selection.
>         Flushes typeahead."
>
>        | char left right startIndex stopIndex oldSelection which text |
>        char := aKeyboardEvent keyCharacter.
>        char = $9 ifTrue: [ char := $( ].
>        char = $, ifTrue: [ char := $< ].
>        char = $[ ifTrue: [ char := ${ ].
>        char = $' ifTrue: [ char := $" ].
>        char asciiValue = 27 ifTrue: [ char := ${ ].    "ctrl-["
> snip...
>

Reply | Threaded
Open this post in threaded view
|

Re: The shiftEnclose: horror show

Stéphane Ducasse
What is on our todo is to introduce keymapper or another solution to have no hardcoded keys in the complete system.
Now my time is short... sadly. But indeed this is good if we can clean that part.
Stef


> http://code.google.com/p/pharo/issues/detail?id=4599
>
> 2011/8/4 Nicolas Cellier <[hidden email]>:
>> I'm typing this message on a mac French keyboard.
>> That means I can obtain the holy brackets [ | ] only through weird
>> keystroke combinations
>> | = shit+option+L
>> [ = shift+option+( where shift+5 is (
>>
>> Enclosing a text in square brackets would require some finger torture
>> both in Squeak/Pharo
>> shift+option+command+(
>> But this does not work because of #shiftEnclose: rules encountered in
>> #initializeShiftCmdKeyShortcuts
>> (found both ParagraphEditor class and TextEditor class)
>>
>>        "Note: Command key overrides shift key, so, for example, cmd-shift-9
>> produces $9 not $("
>>        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
>> #shiftEnclose: ].       "({< and double-quote"
>>        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
>> Mac FKey command."
>>
>> shiftEnclose: is badly designed because it does hardcode the keyboard
>> layout (see below).
>> This is not compatible with modern VMs, at least the mac ones, because
>> they deliver a unicode codePoint for $[ or $|, not a raw keycode.
>> It's easy to remove this anachronism and correct the mapping:
>>
>>        "On some keyboards, these characters require a shift"
>>        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
>>
>> To avoid pushing a mac-centric change in trunk, I need to know if the
>> Linux/Windows VM would support above modification.
>> Can anyone check for me ?
>>
>> Nicolas
>>
>>
>>
>>
>>
>> Example of hardcoded keyboard layout:
>> TextEditor>>shiftEnclose: aKeyboardEvent
>>        "Insert or remove bracket characters around the current selection.
>>         Flushes typeahead."
>>
>>        | char left right startIndex stopIndex oldSelection which text |
>>        char := aKeyboardEvent keyCharacter.
>>        char = $9 ifTrue: [ char := $( ].
>>        char = $, ifTrue: [ char := $< ].
>>        char = $[ ifTrue: [ char := ${ ].
>>        char = $' ifTrue: [ char := $" ].
>>        char asciiValue = 27 ifTrue: [ char := ${ ].    "ctrl-["
>> snip...
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: The shiftEnclose: horror show

Nicolas Cellier
as long as the keyMapper only map to #enclose: and not #shiftEnclose:,
no problem.

Nicolas

2011/8/4 Stéphane Ducasse <[hidden email]>:

> What is on our todo is to introduce keymapper or another solution to have no hardcoded keys in the complete system.
> Now my time is short... sadly. But indeed this is good if we can clean that part.
> Stef
>
>
>> http://code.google.com/p/pharo/issues/detail?id=4599
>>
>> 2011/8/4 Nicolas Cellier <[hidden email]>:
>>> I'm typing this message on a mac French keyboard.
>>> That means I can obtain the holy brackets [ | ] only through weird
>>> keystroke combinations
>>> | = shit+option+L
>>> [ = shift+option+( where shift+5 is (
>>>
>>> Enclosing a text in square brackets would require some finger torture
>>> both in Squeak/Pharo
>>> shift+option+command+(
>>> But this does not work because of #shiftEnclose: rules encountered in
>>> #initializeShiftCmdKeyShortcuts
>>> (found both ParagraphEditor class and TextEditor class)
>>>
>>>        "Note: Command key overrides shift key, so, for example, cmd-shift-9
>>> produces $9 not $("
>>>        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
>>> #shiftEnclose: ].       "({< and double-quote"
>>>        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
>>> Mac FKey command."
>>>
>>> shiftEnclose: is badly designed because it does hardcode the keyboard
>>> layout (see below).
>>> This is not compatible with modern VMs, at least the mac ones, because
>>> they deliver a unicode codePoint for $[ or $|, not a raw keycode.
>>> It's easy to remove this anachronism and correct the mapping:
>>>
>>>        "On some keyboards, these characters require a shift"
>>>        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
>>>
>>> To avoid pushing a mac-centric change in trunk, I need to know if the
>>> Linux/Windows VM would support above modification.
>>> Can anyone check for me ?
>>>
>>> Nicolas
>>>
>>>
>>>
>>>
>>>
>>> Example of hardcoded keyboard layout:
>>> TextEditor>>shiftEnclose: aKeyboardEvent
>>>        "Insert or remove bracket characters around the current selection.
>>>         Flushes typeahead."
>>>
>>>        | char left right startIndex stopIndex oldSelection which text |
>>>        char := aKeyboardEvent keyCharacter.
>>>        char = $9 ifTrue: [ char := $( ].
>>>        char = $, ifTrue: [ char := $< ].
>>>        char = $[ ifTrue: [ char := ${ ].
>>>        char = $' ifTrue: [ char := $" ].
>>>        char asciiValue = 27 ifTrue: [ char := ${ ].    "ctrl-["
>>> snip...
>>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The shiftEnclose: horror show

Stéphane Ducasse
so far I have no idea :)
But I will learn.

Stef

On Aug 4, 2011, at 3:07 PM, Nicolas Cellier wrote:

> as long as the keyMapper only map to #enclose: and not #shiftEnclose:,
> no problem.
>
> Nicolas
>
> 2011/8/4 Stéphane Ducasse <[hidden email]>:
>> What is on our todo is to introduce keymapper or another solution to have no hardcoded keys in the complete system.
>> Now my time is short... sadly. But indeed this is good if we can clean that part.
>> Stef
>>
>>
>>> http://code.google.com/p/pharo/issues/detail?id=4599
>>>
>>> 2011/8/4 Nicolas Cellier <[hidden email]>:
>>>> I'm typing this message on a mac French keyboard.
>>>> That means I can obtain the holy brackets [ | ] only through weird
>>>> keystroke combinations
>>>> | = shit+option+L
>>>> [ = shift+option+( where shift+5 is (
>>>>
>>>> Enclosing a text in square brackets would require some finger torture
>>>> both in Squeak/Pharo
>>>> shift+option+command+(
>>>> But this does not work because of #shiftEnclose: rules encountered in
>>>> #initializeShiftCmdKeyShortcuts
>>>> (found both ParagraphEditor class and TextEditor class)
>>>>
>>>>        "Note: Command key overrides shift key, so, for example, cmd-shift-9
>>>> produces $9 not $("
>>>>        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
>>>> #shiftEnclose: ].       "({< and double-quote"
>>>>        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
>>>> Mac FKey command."
>>>>
>>>> shiftEnclose: is badly designed because it does hardcode the keyboard
>>>> layout (see below).
>>>> This is not compatible with modern VMs, at least the mac ones, because
>>>> they deliver a unicode codePoint for $[ or $|, not a raw keycode.
>>>> It's easy to remove this anachronism and correct the mapping:
>>>>
>>>>        "On some keyboards, these characters require a shift"
>>>>        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
>>>>
>>>> To avoid pushing a mac-centric change in trunk, I need to know if the
>>>> Linux/Windows VM would support above modification.
>>>> Can anyone check for me ?
>>>>
>>>> Nicolas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Example of hardcoded keyboard layout:
>>>> TextEditor>>shiftEnclose: aKeyboardEvent
>>>>        "Insert or remove bracket characters around the current selection.
>>>>         Flushes typeahead."
>>>>
>>>>        | char left right startIndex stopIndex oldSelection which text |
>>>>        char := aKeyboardEvent keyCharacter.
>>>>        char = $9 ifTrue: [ char := $( ].
>>>>        char = $, ifTrue: [ char := $< ].
>>>>        char = $[ ifTrue: [ char := ${ ].
>>>>        char = $' ifTrue: [ char := $" ].
>>>>        char asciiValue = 27 ifTrue: [ char := ${ ].    "ctrl-["
>>>> snip...
>>>>
>>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: The shiftEnclose: horror show

Nicolas Cellier
In reply to this post by Nicolas Cellier
I had a possibility to try in Windows where the [ is obtained via
AltGr+5 on a french keyboard, but the combination Alt+AltGr+5 does not
work on this machine.
So #enclose: a pair [ ] or { } or | | is not possible on such keyboard
Note that the old #shiftEnclose: was not of any help, so the change
does not make it worse.

Nicolas

2011/8/4 Nicolas Cellier <[hidden email]>:

> I'm typing this message on a mac French keyboard.
> That means I can obtain the holy brackets [ | ] only through weird
> keystroke combinations
> | = shit+option+L
> [ = shift+option+( where shift+5 is (
>
> Enclosing a text in square brackets would require some finger torture
> both in Squeak/Pharo
> shift+option+command+(
> But this does not work because of #shiftEnclose: rules encountered in
> #initializeShiftCmdKeyShortcuts
> (found both ParagraphEditor class and TextEditor class)
>
>        "Note: Command key overrides shift key, so, for example, cmd-shift-9
> produces $9 not $("
>        '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put:
> #shiftEnclose: ].       "({< and double-quote"
>        "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a
> Mac FKey command."
>
> shiftEnclose: is badly designed because it does hardcode the keyboard
> layout (see below).
> This is not compatible with modern VMs, at least the mac ones, because
> they deliver a unicode codePoint for $[ or $|, not a raw keycode.
> It's easy to remove this anachronism and correct the mapping:
>
>        "On some keyboards, these characters require a shift"
>        '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
>
> To avoid pushing a mac-centric change in trunk, I need to know if the
> Linux/Windows VM would support above modification.
> Can anyone check for me ?
>
> Nicolas
>
>
>
>
>
> Example of hardcoded keyboard layout:
> TextEditor>>shiftEnclose: aKeyboardEvent
>        "Insert or remove bracket characters around the current selection.
>         Flushes typeahead."
>
>        | char left right startIndex stopIndex oldSelection which text |
>        char := aKeyboardEvent keyCharacter.
>        char = $9 ifTrue: [ char := $( ].
>        char = $, ifTrue: [ char := $< ].
>        char = $[ ifTrue: [ char := ${ ].
>        char = $' ifTrue: [ char := $" ].
>        char asciiValue = 27 ifTrue: [ char := ${ ].    "ctrl-["
> snip...
>