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

commits at source.squeak.org commits at source.squeak.org
Tue Mar 15 08:28:23 UTC 2022


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

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

Name: Morphic-mt.1938
Author: mt
Time: 15 March 2022, 9:28:17.475861 am
UUID: 0e13843e-0161-2b45-a5fa-e0dfa94ff16f
Ancestors: Morphic-mt.1937

Tweak the recent change in TextEditor shortcuts about emphasis:

[CMD]+[5] ... Still emphasis menu
[CMD]+[6] ... Italic (new)
[CMD]+[7] ... Bold (as it has always been)
[CMD]+[8] ... Struck-out (new)
[CMD]+[9] ... Underline (new)
[CMD]+[0] ... Clear

And remember this: nine is fine for underline, obliter-eight it as you see fit, seven has been bold for ever'n, which leaves six as the obivous fix to emphasize your poetics.

Thanks to Chris (cmm) for the idea!

=============== Diff against Morphic-mt.1937 ===============

Item was changed:
  ----- Method: TextEditor>>changeEmphasis: (in category 'editing keys') -----
  changeEmphasis: aKeyboardEvent 
  	"Change the emphasis of the current selection or prepare to accept characters with the change in emphasis. Emphasis change amounts to a font change.  Keeps typeahead."
  
  	"[cmd]+[0..9]"
  
  	| keyCode attribute oldAttributes index thisSel colors extras |
  	keyCode := ('0123456789' indexOf: aKeyboardEvent keyCharacter ifAbsent: [1]) - 1.
  	oldAttributes := paragraph text attributesAt: self pointIndex.
  	thisSel := self selection.
  
  	"mt: Index-based font changes are not compatible with variable point sizes in text styles. Make room for other shortcuts.
  	(keyCode between: 1 and: 5) ifTrue: [attribute := TextFontChange fontNumber: keyCode]."
  
  	keyCode = 5 
  		ifTrue: [
  			colors := #(#black #magenta #red #yellow #green #blue #cyan #white).
  			extras := self emphasisExtras.
  			index := Project uiManager chooseFrom: colors , #('choose color...' ), extras.
  			index = 0 ifTrue: [^true].
  			index <= colors size 
  				ifTrue: [attribute := TextColor color: (Color perform: (colors at: index))]
  				ifFalse: [
  					index := index - colors size - 1.	"Re-number!!!!!!"
  					index = 0 
  						ifTrue: [attribute := self chooseColor]
  						ifFalse:[^self handleEmphasisExtra: index with: aKeyboardEvent]	"handle an extra"]].
  	(keyCode between: 6 and: 9) 
  		ifTrue: [
  			aKeyboardEvent shiftPressed 
  				ifTrue: [ "Cannot be reached bc. method entry is #keyCharacter based and thus dependent on keyboard layout."
  					keyCode = 6 ifTrue: [attribute := TextKern kern: -1].
  					keyCode = 7 ifTrue: [attribute := TextKern kern: 1]]
  				ifFalse: [
  					attribute := TextEmphasis
+ 						"And remember this: nine is fine for underline, obliter-eight it as you see fit, seven has been bold for ever'n, which leaves six as the obivous fix to emphasize your poetics." 
+ 						perform: (#(italic bold struckOut underlined) at: keyCode - 5).
- 						perform: (#(#bold #italic #underlined #struckOut) at: keyCode - 5).
  					oldAttributes
  						do: [:att | (att dominates: attribute) ifTrue: [attribute turnOff]]]].
  	keyCode = 0 ifTrue: [attribute := TextEmphasis normal].
  	attribute ifNotNil: [
  		thisSel size = 0
  			ifTrue: [
  				"only change emphasisHere while typing"
  				self insertTypeAhead.
  				emphasisHere := Text addAttribute: attribute toArray: oldAttributes ]
  			ifFalse: [
  				self replaceSelectionWith: (thisSel asText addAttribute: attribute) ]].
  	^true!



More information about the Squeak-dev mailing list