[squeak-dev] The Inbox: Kernel-mt.1287.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Dec 13 15:35:47 UTC 2019


> This happens automatically when "duplicate (all) control and alt keys" or "swap control and alt keys" is enabled.


Let me correct this. The preference "swap control and alt keys" does *not* map control keys to printable characters. Just swapping. I think we should rename "Duplicate (all) control and alt keys" to "Overwrite all control keys with alt/command keys".

Sigh.

Best,
Marcel
Am 13.12.2019 16:30:26 schrieb commits at source.squeak.org <commits at source.squeak.org>:
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-mt.1287.mcz

==================== Summary ====================

Name: Kernel-mt.1287
Author: mt
Time: 13 December 2019, 4:30:11.846615 pm
UUID: 1e52cdbe-487d-ed47-8510-c491c1d57fca
Ancestors: Kernel-mt.1286

Proposal: Always map control characters to printable characters. This happens automatically when "duplicate (all) control and alt keys" or "swap control and alt keys" is enabled. But NOT when all of those preferences are disabled. Which can be surprising because when you type [ctrl]+[c], you expect a key value of 99 like in [cmd/alt]+[c]. ... and not 3 :-)

This is a proposal because we also would have to adapt and test:

TextEditor >> #dispatchOnKeyboardEvent:
TextEditor class >> #initializeShiftCmdKeyShortcuts
Editor class >> #specialShiftCmdKeys

=============== Diff against Kernel-mt.1286 ===============

Item was added:
+ ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
+ installControlKeyEntryFor: c
+ "Updates key-decode table. The table maps pairs of {character code . modifier code}. See the class comment for more information. Note that the bitmask 16r9F is used to convert control characters (ascii 0 to 31) to printable characters."
+
+ | upper lower |
+ upper := c asUppercase asInteger.
+ lower := c asLowercase asInteger.
+
+ KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 "ctrl" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 2 bitOr: 1 "ctrl+shift" }.
+ !

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps some keys if
Preferences swapControlAndAltKeys is set"
KeyDecodeTable := Dictionary new.
+
+ "In any case, translate all control characters to printable characters."
+ 64 +1 "because 0 is special, see UTF32InputInterpreter"
+ to: 95 -2 "except for our mouse-wheel up/down hack"
+ do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
+
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
Preferences swapControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191213/ad7a722c/attachment.html>


More information about the Squeak-dev mailing list