[squeak-dev] The Inbox: Morphic-ct.1948.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 26 18:06:24 UTC 2022

A new version of Morphic was added to project The Inbox:

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

Name: Morphic-ct.1948
Author: ct
Time: 26 March 2022, 7:06:05.220434 pm
UUID: ad66cc3a-8fbf-d24e-bb86-d6217676c3cb
Ancestors: Morphic-ct.1946

Disables "change emphasis" shortcuts for plaintext-only editors and decouples SmalltalkEditor from TextMorphForEditView (morph might also be a StringMorphEditor without #editView).

=============== Diff against Morphic-ct.1946 ===============

Item was changed:
  ----- Method: SmalltalkEditor>>styler (in category 'accessing') -----
  	"Answers the styler for this editor. Only code editors support syntax highlighting"
+ 	^ (self morph respondsTo: #editView)
+ 		ifTrue: [self morph editView styler]
- 	^ self morph editView styler

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."
  	| keyCode attribute oldAttributes index thisSel colors extras |
+ 	self morph plainTextOnly ifTrue: [^ true].
  	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).
  						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) ]].

More information about the Squeak-dev mailing list