[squeak-dev] The Trunk: Morphic-mt.1829.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Dec 25 15:00:01 UTC 2021


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

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

Name: Morphic-mt.1829
Author: mt
Time: 25 December 2021, 3:59:52.894982 pm
UUID: 056374e3-9765-3447-b438-be41c057f1b1
Ancestors: Morphic-mt.1828

Re-adds keyboard shortcuts cmd+[ etc. as "Legacy shortcuts" via preference for US/UK keyboard layouts. Disabled by default.
	
LegacyShortcutsFilter legacyShortcutsEnabled: true.

Note that there is a minor conflict with the global cmd+] shortcut (i.e., remove one level of brackets) for saving the image, which will be disabled then legacy shortcuts are enabled.

=============== Diff against Morphic-mt.1828 ===============

Item was added:
+ Object subclass: #LegacyShortcutsFilter
+ 	instanceVariableNames: ''
+ 	classVariableNames: 'LegacyShortcutsEnabled'
+ 	poolDictionaries: ''
+ 	category: 'Morphic-Text Support'!
+ 
+ !LegacyShortcutsFilter commentStamp: 'mt 12/25/2021 14:40' prior: 0!
+ I am an event filter that provides keyboard shortcuts for TextEdtior that have been deprecated due to their incompatibility for non-US keyboard layouts.
+ 
+ For more information, read on here:
+ http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217304.html!

Item was added:
+ ----- Method: LegacyShortcutsFilter class>>filterEvent:for: (in category 'event filter') -----
+ filterEvent: aKeyboardEvent for: textMorph
+ 
+ 	aKeyboardEvent isKeystroke ifFalse: [^ aKeyboardEvent].
+ 	aKeyboardEvent commandKeyPressed ifFalse: [^ aKeyboardEvent].
+ 	Preferences cmdKeysInText ifFalse: [^ aKeyboardEvent].
+ 		
+ 	('()[]{}|''"<>' includes: aKeyboardEvent keyCharacter)
+ 		ifTrue: [textMorph
+ 				handleInteraction: [(textMorph editor enclose: aKeyboardEvent) ifTrue: [aKeyboardEvent ignore]]
+ 				fromEvent: aKeyboardEvent].
+ 
+ 	^ aKeyboardEvent
+ 
+ "
+ Preferences cmdKeysInText
+ Preferences cmdGesturesEnabled
+ Preferences honorDesktopCmdKeys
+ PasteUpMorph globalCommandKeysEnabled.
+ "!

Item was added:
+ ----- Method: LegacyShortcutsFilter class>>legacyShortcutsEnabled (in category 'preferences') -----
+ legacyShortcutsEnabled
+ 	<preference: 'Legacy keyboard shortcuts (US/UK only)'
+ 		categoryList: #(Morphic keyboard editing)
+ 		description: 'When true, text editors will support legacy keyboard shortcuts, which were originally introduced for US/UK keyboard layouts but are incompatible to several other international layouts. Includes shortcuts to enclose open brackets with closing ones and text selections with opening and closing ones.'
+ 		type: #Boolean>
+ 
+ 	^ LegacyShortcutsEnabled ifNil: [false]!

Item was added:
+ ----- Method: LegacyShortcutsFilter class>>legacyShortcutsEnabled: (in category 'preferences') -----
+ legacyShortcutsEnabled: aBoolean
+ 
+ 	LegacyShortcutsEnabled = aBoolean ifTrue: [^ self].
+ 	LegacyShortcutsEnabled := aBoolean.
+ 
+ 	self legacyShortcutsEnabled
+ 		ifTrue: [
+ 			TextMorphForEditView allInstancesDo: [:textMorph |
+ 				textMorph addKeyboardCaptureFilter: self]]
+ 		ifFalse: [
+ 			TextMorphForEditView allInstancesDo: [:textMorph |
+ 				textMorph removeKeyboardCaptureFilter: self]].!

Item was changed:
  ----- Method: PasteUpMorph>>tryInvokeKeyboardShortcut: (in category 'events-processing') -----
  tryInvokeKeyboardShortcut: aKeyboardEvent
  
  	aKeyboardEvent commandKeyPressed ifFalse: [^ self].
  	
  	aKeyboardEvent keyCharacter caseOf: {
  		[$R] -> [Utilities browseRecentSubmissions].
  		[$L] -> [self findAFileList: aKeyboardEvent].
  		[$O] -> [self findAMonticelloBrowser].
  		[$P] -> [self findAPreferencesPanel: aKeyboardEvent].
  		"[$Z] -> [ChangeList browseRecentLog]."
+ 		[$]] -> [LegacyShortcutsFilter legacyShortcutsEnabled
+ 			ifTrue: [^ self "Keep going."]
+ 			ifFalse: [Smalltalk snapshot: true andQuit: false]].
- 		[$]] -> [Smalltalk snapshot: true andQuit: false].
  	} otherwise: [^ self "no hit"].
  	
  	aKeyboardEvent ignore "hit!!".!

Item was changed:
  ----- Method: PluggableTextMorph>>initializeTextMorph (in category 'initialization') -----
  initializeTextMorph
  
  	textMorph := self textMorphClass new
  		margins: (3 at 0 corner: 0 at 0);
  		setEditView: self;
  		hResizing: #shrinkWrap;
  		vResizing: #shrinkWrap;
  		setProperty: #indicateKeyboardFocus toValue: #never;
+ 		yourself.
+ 		
+ 	LegacyShortcutsFilter legacyShortcutsEnabled
+ 		ifTrue: [textMorph addKeyboardCaptureFilter: LegacyShortcutsFilter].!
- 		yourself.!



More information about the Squeak-dev mailing list