The Trunk: Morphic-mt.1291.mcz

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

The Trunk: Morphic-mt.1291.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1291.mcz

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

Name: Morphic-mt.1291
Author: mt
Time: 19 August 2016, 6:35:22.021803 pm
UUID: 8443628c-5f86-ee46-a68e-cd1c3a6f7b8f
Ancestors: Morphic-mt.1290

Fix some edge cases when printing keyboard events.

=============== Diff against Morphic-mt.1290 ===============

Item was changed:
  ----- Method: KeyboardEvent>>printKeyStringOn: (in category 'printing') -----
  printKeyStringOn: aStream
  "Print a readable string representing the receiver on a given stream"
 
  | kc inBrackets firstBracket keyString |
  kc := self keyCharacter.
  inBrackets := false.
  firstBracket := [ inBrackets ifFalse: [ aStream nextPut: $<. inBrackets := true ]].
  self controlKeyPressed ifTrue: [ firstBracket value. aStream nextPutAll: 'Ctrl-' ].
  self commandKeyPressed ifTrue: [ firstBracket value. aStream nextPutAll: 'Cmd-' ].
  (buttons anyMask: 32) ifTrue: [ firstBracket value. aStream nextPutAll: 'Opt-' ].
+ (self shiftPressed and: [ (keyValue between: 1 and: 31) or: [self keyCharacter = Character delete ]])
- (self shiftPressed and: [ keyValue between: 1 and: 31 ])
  ifTrue: [ firstBracket value. aStream nextPutAll: 'Shift-' ].
 
+ keyString := (kc caseOf: {
+ [ Character space ] -> [ 'space' ].
+ [ Character tab ] -> [ 'tab' ].
+ [ Character cr ] -> [ 'cr' ].
+ [ Character lf ] -> [ 'lf' ].
+ [ Character enter ] -> [ 'enter' ].
- (self controlKeyPressed and: [ keyValue <= 26 ])
- ifTrue:
- [aStream nextPut: (keyValue + $a asciiValue - 1) asCharacter]
- ifFalse:
- [keyString := (kc caseOf: {
- [ Character space ] -> [ ' ' ].
- [ Character tab ] -> [ 'tab' ].
- [ Character cr ] -> [ 'cr' ].
- [ Character lf ] -> [ 'lf' ].
- [ Character enter ] -> [ 'enter' ].
 
+ [ Character backspace ] -> [ 'backspace' ].
+ [ Character delete ] -> [ 'delete' ].
- [ Character backspace ] -> [ 'backspace' ].
- [ Character delete ] -> [ 'delete' ].
 
+ [ Character escape ] -> [ 'escape' ].
- [ Character escape ] -> [ 'escape' ].
 
+ [ Character arrowDown ] -> [ 'down' ].
+ [ Character arrowUp ] -> [ 'up' ].
+ [ Character arrowLeft ] -> [ 'left' ].
+ [ Character arrowRight ] -> [ 'right' ].
- [ Character arrowDown ] -> [ 'down' ].
- [ Character arrowUp ] -> [ 'up' ].
- [ Character arrowLeft ] -> [ 'left' ].
- [ Character arrowRight ] -> [ 'right' ].
 
+ [ Character end ] -> [ 'end' ].
+ [ Character home ] -> [ 'home' ].
+ [ Character pageDown ] -> [ 'pageDown' ].
+ [ Character pageUp ] -> [ 'pageUp' ].
- [ Character end ] -> [ 'end' ].
- [ Character home ] -> [ 'home' ].
- [ Character pageDown ] -> [ 'pageDown' ].
- [ Character pageUp ] -> [ 'pageUp' ].
 
+ [ Character euro ] -> [ 'euro' ].
+ [ Character insert ] -> [ 'insert' ].
- [ Character euro ] -> [ 'euro' ].
- [ Character insert ] -> [ 'insert' ].
 
+ } otherwise: [ String with: kc ]).
+
+ keyString size > 1 ifTrue: [ firstBracket value ].
+ aStream nextPutAll: keyString.
- } otherwise: [ String with: kc ]).
- keyString size > 1 ifTrue: [ firstBracket value ].
- aStream nextPutAll: keyString].
 
  inBrackets ifTrue: [aStream nextPut: $> ]!

Item was changed:
  ----- Method: KeyboardEvent>>printOn: (in category 'printing') -----
  printOn: aStream
  "Print the receiver on a stream"
 
  aStream nextPut: $[.
  aStream nextPutAll: self cursorPoint printString; space.
  aStream nextPutAll: type; nextPutAll: ' '''.
  self printKeyStringOn: aStream.
  aStream nextPut: $'; space.
+ aStream nextPut: $(.
+ aStream nextPutAll: keyValue printString.
+ aStream nextPut: $); space.
  aStream nextPutAll: timeStamp printString.
  aStream nextPut: $]!