Auto Enclose broken (was: Re: [squeak-dev] The shiftEnclose: horror
show)
Chris Muller
asqueaker at gmail.com
Mon Aug 8 23:18:25 UTC 2011
Only the closing character is typed, not the opening..
On Thu, Aug 4, 2011 at 3:15 AM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 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...
>
>
More information about the Squeak-dev
mailing list
|