Chris Muller uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-cmm.928.mcz
==================== Summary ====================
Name: Tools-cmm.928
Author: cmm
Time: 20 December 2019, 10:06:10.77308 pm
UUID: e1a28262-590a-443a-83d8-6e994b0f676b
Ancestors: Tools-mt.925
Fix DictionaryInspector to allow debugging of Dictionary initialization, and render the entries in order for OrderedDictionary's.
=============== Diff against Tools-mt.925 ===============
Item was changed:
----- Method: DictionaryInspector>>calculateKeyArray (in category 'selecting') -----
calculateKeyArray
+ "Recalculate the KeyArray from the object being inspected."
+ keyArray := [ object keysInOrder ] ifError:
+ [ "Can occur when debugging Dictionary new"
+ Array empty ].
+ selectionIndex := 0!
- "Recalculate the KeyArray from the object being inspected"
-
- keyArray := object keysSortedSafely asArray.
- selectionIndex := 0.
- !
Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz
==================== Summary ====================
Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291
Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).
Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)
One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.
I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...
=============== Diff against Kernel-nice.1291 ===============
Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
- self flag: #unixOnly.
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
Item was changed:
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
installDuplicateKeyEntryFor: aPrintableCharacter
+ "Updates the key-decode table, which maps between pairs of {character code . modifier code}.
+ See the class comment for more information.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert control characters to printable characters in this mapping table."
- "Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
- Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
+ KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
- KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.
- KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower . 8 bitOr: 2 "cmd/alt + ctrl" }.
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt + shift" } put: { upper . (8 bitOr: 2) bitOr: 1 "cmd/alt + ctrl + shift" }.
-
- "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
- self flag: #unixOnly.
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.!
Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."
KeyDecodeTable := Dictionary new.
- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!
Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.
-
- "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
- self flag: #unixOnly.
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
Nicolas Cellier uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-nice.867.mcz
==================== Summary ====================
Name: Collections-nice.867
Author: nice
Time: 27 December 2019, 10:29:53.018596 pm
UUID: d3b5ceb3-62ab-4f61-a9a3-dd757041b47f
Ancestors: Collections-mt.866
Fix sendersOfIt for searching senders of an expression including a literal (byte) array
If you select following text
preference: 'Send Mouse Wheel Events to Keyboard Focus'
categoryList: #(Morphic keyboard mouse)
description: 'If enabled, follow the behavior known from Microsoft Windows, where the mouse wheel works for the widget that has the keyboard focus. If disabled, follow the Mac OS style, where the mouse wheel is send to the widget under the mouse position'
type: #Boolean
and browse senders, then if search for senders of #preference: instead of the whole keyword
This is because '#(Morphic keyboard mouse)' was replaced with '#aSymbol keyboard mouse)'
=============== Diff against Collections-mt.866 ===============
Item was changed:
----- Method: String>>findSelector (in category 'converting') -----
findSelector
"Dan's code for hunting down selectors with keyword parts; while this doesn't give a true parse, in most cases it does what we want, in where it doesn't, we're none the worse for it."
| sel possibleParens |
sel := self withBlanksTrimmed.
(sel includes: $:)
ifTrue:
[sel := sel copyWithRegex: '''[^'']*''' matchesReplacedWith: '''a string'''.
+ sel := sel copyWithRegex: '#[^\[\(\s\.$]*' matchesReplacedWith: '#aSymbol'.
- sel := sel copyWithRegex: '#[^\s\.$]*' matchesReplacedWith: '#aSymbol'.
sel := sel copyReplaceAll: ':' with: ': '. "for the style (aa max:bb) with no space"
sel := sel copyReplaceAll: '[:' with: '[ :'. "for the style ([:a) with no space"
possibleParens := sel substrings.
sel := self class streamContents:
[:s | | level |
level := 0.
possibleParens do:
[:token |
(level = 0 and: [token endsWith: ':'])
ifTrue: [s nextPutAll: token]
ifFalse: [level := level
+ (token occurrencesOf: $() - (token occurrencesOf: $))
+ (token occurrencesOf: $[) - (token occurrencesOf: $])
+ (token occurrencesOf: ${) - (token occurrencesOf: $})]]]]
ifFalse:
[sel := self substrings ifNotEmpty: [:tokens | tokens last]].
sel ifEmpty: [^ nil].
sel first = $# ifTrue:
[sel := sel allButFirst.
sel ifEmpty: [^ nil]].
sel isOctetString ifTrue: [sel := sel asOctetString].
^ Symbol lookup: sel!
[cid:2bb2f527-4515-4004-b7e5-1c84e013ccff]
(No, this is not caused by XmasDecorations)
How can one fix this? Changing #wrapDirection in #newButtonRow to #leftToRight did not help (but it impeded the transparent filler).
Best,
Christoph
It may be Feature Freeze time but it certainly isn't Help Page freeze. I've submitted some changes for a few of the 'The Project' pages but there are still lots needing improvement.
A few suggestions for things to write about -
(general) clean up references to the various screen menus and TheWorldMenu and Dock menus and .... it's complicated. If you refer to mouse buttons please consider using the venerable Red/Yellow/Blue names instead of cmd-click etc - those are very machine specific. I added an explanation of red/yellow/blue to the 'Squeak User Interface' page.
Browser(s) - there's no help page for code browsers! We really could do with explanations of the system browser, the message browsers ( including the joy of the tracing browsers capabilities) hierarchy browser... pretty important tools.
Debugger - needs waaay more.
Tutorials->Command Key Mappings almost certainly needs checking and extending. And should it perhaps be moved to the Tools section?
Core Packages->Commonly Used - Traits ? commonly used? Really? And at the very least the URL pointed to needs checking
Terse Guide - it would be smart tp run through all the sections and make sure everything works as expected. The underscore assign needs removing, as has already been mentioned today.
tim
--
tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: MD: Move and Drop bits
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1289.mcz
==================== Summary ====================
Name: Kernel-mt.1289
Author: mt
Time: 19 December 2019, 11:45:58.637761 am
UUID: e9f9d6a0-0ce8-114e-b3d2-26b481f590a1
Ancestors: Kernel-mt.1288
- fixes ctrl <-> alt key swapping bug in #processEvent:
- fixes ctrl <-> alt key swapping by extending the range to the same range as for "duplicate *all*"
- LINUX ONLY: fixes swapping and duplication of ctrl/alt keys
- LINUX ONLY: maps controls keys that arrive as ASCII 64 to 127 down to ASCII 0 to 31
- document that other (older) "duplicate keys" preference to be deprecated after the 5.3 release
So, the current VM 201911282316 should be fine for all platforms for Squeak 5.3 at the moment.
=============== Diff against Kernel-mt.1288 ===============
Item was added:
+ ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
+ installControlKeyEntryFor: aPrintableCharacter
+
+ | upper lower |
+ self assert: (aPrintableCharacter asInteger between: 64 and: 95).
+
+ upper := aPrintableCharacter asInteger.
+ lower := aPrintableCharacter asInteger bitOr: 16r20.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
Item was changed:
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
installDuplicateKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
- !
Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
+ "Create a decode table that swaps or duplicates some keys if the respective preference is set."
+
- "Create a decode table that swaps some keys if
- Preferences swapControlAndAltKeys is set"
KeyDecodeTable := Dictionary new.
+
+ "In any case, ensure that control keys are mapped correctly."
+ self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
+ 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
+
- Preferences duplicateControlAndAltKeys
- ifTrue: [ self defaultCrossPlatformKeys do:
- [ :c | self installDuplicateKeyEntryFor: c ] ].
Preferences swapControlAndAltKeys
+ ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
- ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
+
+ self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
+ Preferences duplicateControlAndAltKeys
+ ifTrue: [ self defaultCrossPlatformKeys do:
+ [ :c | self installDuplicateKeyEntryFor: c ] ].
!
Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
Item was changed:
----- Method: EventSensor>>processEvent: (in category 'private-I/O') -----
processEvent: evt
"Process a single event. This method is run at high priority."
| type buttons window |
type := evt at: 1.
"Only process main window events, forward others to host window proxies"
window := evt at: 8.
(window isNil or: [window isZero]) ifTrue:
[window := 1.
evt at: 8 put: window].
window = 1 ifFalse: [
^Smalltalk at: #HostWindowProxy ifPresent: [:w | w processEvent: evt]].
"Tackle mouse events and mouse wheel events first"
(type = EventTypeMouse or: [type = EventTypeMouseWheel])
ifTrue: [buttons := (ButtonDecodeTable at: (evt at: 5) + 1).
evt at: 5 put: (Smalltalk platformName = 'Mac OS'
ifTrue: [ buttons ]
ifFalse: [ self mapButtons: buttons modifiers: (evt at: 6) ]).
self queueEvent: evt.
type = EventTypeMouse ifTrue: [self processMouseEvent: evt].
type = EventTypeMouseWheel ifTrue: [self processMouseWheelEvent: evt].
^self].
"Store the event in the queue if there's any"
type = EventTypeKeyboard
ifTrue: [ "Check if the event is a user interrupt"
((evt at: 4) = EventKeyChar
and: [((evt at: 3)
bitOr: (((evt at: 5)
bitAnd: 8)
bitShift: 8))
= interruptKey])
ifTrue: ["interrupt key is meta - not reported as event"
^ interruptSemaphore signal].
"Decode keys for characters (i.e., duplicate or swap, ctrl <-> alt/cmd)."
(evt at: 4) = EventKeyChar
+ ifTrue: [ | unicode ascii |
+ "Copy lookup key first in case of key swap."
+ unicode := {evt at: 6. evt at: 5}.
+ ascii := {evt at: 3. evt at: 5}.
- ifTrue: [
KeyDecodeTable "Unicode character first"
+ at: unicode
- at: {evt at: 6. evt at: 5}
ifPresent: [:a | evt at: 6 put: a first;
at: 5 put: a second].
KeyDecodeTable "ASCII character second"
+ at: ascii
- at: {evt at: 3. evt at: 5}
ifPresent: [:a | evt at: 3 put: a first;
at: 5 put: a second]].
self queueEvent: evt.
self processKeyboardEvent: evt .
^self ].
"Handle all events other than Keyboard or Mouse."
self queueEvent: evt.
!
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1290.mcz
==================== Summary ====================
Name: Kernel-mt.1290
Author: mt
Time: 23 December 2019, 11:24:23.728349 am
UUID: b2e649ef-ad9d-5040-b6b0-70b7e29e4085
Ancestors: Kernel-mt.1289
Do actually *duplicate* CTRL and CMD/ALT keys if that preference is enabled.
This means that such key-stroke events will always answer TRUE to both #controlKeyPressed and #commandKeyPressed. This solves various issues in client code. Now all paths that only check for #controlKeyPressed will match even if the duplication preference is enabled.
Note that for applications that do want to make use of CTRL and ALT/CMD in separate ways, the PREFERENCE "duplicate (all) ctrl and alt keys" has to be DISABLED. Those applications can easily check and inform the user.
Also note that key duplication means that there is no way to detect actual control keys. Disable that preference if you want to hit CTRL+C and, for example, access "Character enter" (ASCII 3) for that event's #keyCharacter.
Finally note that I will double-check effects in TextEditor asap.
=============== Diff against Kernel-mt.1289 ===============
Item was changed:
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
installDuplicateKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
+ KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.
+ KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower . 8 bitOr: 2 "cmd/alt + ctrl" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt + shift" } put: { upper . (8 bitOr: 2) bitOr: 1 "cmd/alt + ctrl + shift" }.
- KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
"For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.!
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.868.mcz
==================== Summary ====================
Name: Collections-nice.868
Author: nice
Time: 28 December 2019, 1:23:35.502843 pm
UUID: e4026d16-31b5-430f-8c22-6475db37bb91
Ancestors: Collections-mt.866
Fix RunArrayTest>>testAt2 (testing access out of bounds)
Beware, Text depends on this feature of accessing runs out of bounds, because the characterIndex might be past end.
To avoid problems, transform previous #at: implementation into #atPin: and use that in Text.
#atPin: clamps the index in accessible range.
=============== Diff against Collections-mt.866 ===============
Item was changed:
----- Method: RunArray>>at: (in category 'accessing') -----
at: index
+ self at: index setRunOffsetAndValue: [:run :offset :value |
+ offset < 0 ifTrue: [ self errorSubscriptBounds: index ].
+ offset >= (runs at: run) ifTrue: [ self errorSubscriptBounds: index ].
+ ^value]!
- self at: index setRunOffsetAndValue: [:run :offset :value | ^value]!
Item was added:
+ ----- Method: RunArray>>atPin: (in category 'accessing') -----
+ atPin: index
+
+ self at: index setRunOffsetAndValue: [:run :offset :value | ^value]!
Item was changed:
----- Method: Text>>alignmentAt:ifAbsent: (in category 'emphasis') -----
alignmentAt: characterIndex ifAbsent: aBlock
| attributes emph |
self size = 0 ifTrue: [^aBlock value].
emph := nil.
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
attributes do:[:att | (att isKindOf: TextAlignment) ifTrue:[emph := att]].
emph ifNil: [ ^aBlock value ].
^emph alignment!
Item was changed:
----- Method: Text>>attributesAt: (in category 'emphasis') -----
attributesAt: characterIndex
"Answer the code for characters in the run beginning at characterIndex."
"NB: no senders any more (supplanted by #attributesAt:forStyle: but retained for the moment in order not to break user code that may exist somewhere that still calls this"
| attributes |
self size = 0
ifTrue: [^ Array with: (TextFontChange new fontNumber: 1)]. "null text tolerates access"
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
^ attributes!
Item was changed:
----- Method: Text>>attributesAt:do: (in category 'emphasis') -----
attributesAt: characterIndex do: aBlock
"Answer the code for characters in the run beginning at characterIndex."
"NB: no senders any more (supplanted by #attributesAt:forStyle: but retained for the moment in order not to break user code that may exist somewhere that still calls this"
self size = 0 ifTrue:[^self].
+ (runs atPin: characterIndex) do: aBlock!
- (runs at: characterIndex) do: aBlock!
Item was changed:
----- Method: Text>>attributesAt:forStyle: (in category 'emphasis') -----
attributesAt: characterIndex forStyle: aTextStyle
"Answer the code for characters in the run beginning at characterIndex."
| attributes |
self size = 0
ifTrue: [^ Array with: (TextFontChange new fontNumber: aTextStyle defaultFontIndex)]. "null text tolerates access"
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
^ attributes!
Item was changed:
----- Method: Text>>colorAt:ifNone: (in category 'emphasis') -----
colorAt: characterIndex ifNone: block
self size = 0 ifTrue: [^ block value]. "null text tolerates access."
+ ^ (runs atPin: characterIndex)
- ^ (runs at: characterIndex)
detect: [:attr | attr class == TextColor]
ifFound: [:attr | attr color]
ifNone: block!
Item was changed:
----- Method: Text>>emphasisAt: (in category 'emphasis') -----
emphasisAt: characterIndex
"Answer the fontfor characters in the run beginning at characterIndex."
| attributes |
self size = 0 ifTrue: [^ 0]. "null text tolerates access"
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
^attributes inject: 0 into:
[:emph :att | emph bitOr: att emphasisCode].
!
Item was changed:
----- Method: Text>>fontAt:withStyle: (in category 'emphasis') -----
fontAt: characterIndex withStyle: aTextStyle
"Answer the fontfor characters in the run beginning at characterIndex."
| attributes font |
self size = 0 ifTrue: [^ aTextStyle defaultFont]. "null text tolerates access"
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
font := aTextStyle defaultFont. "default"
attributes do:
[:att | att forFontInStyle: aTextStyle do: [:f | font := f]].
^ font!
Item was changed:
----- Method: Text>>fontNumberAt: (in category 'emphasis') -----
fontNumberAt: characterIndex
"Answer the fontNumber for characters in the run beginning at characterIndex."
| attributes fontNumber |
self size = 0 ifTrue: [^1]. "null text tolerates access"
+ attributes := runs atPin: characterIndex.
- attributes := runs at: characterIndex.
fontNumber := 1.
attributes do: [:att | (att isMemberOf: TextFontChange) ifTrue: [fontNumber := att fontNumber]].
^ fontNumber
!