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 <nicolas.cellier.aka.nice@gmail.com>:
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...