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

commits at source.squeak.org commits at source.squeak.org
Sat Mar 26 18:03:35 UTC 2022

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

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

Name: Morphic-ct.1947
Author: ct
Time: 26 March 2022, 7:03:15.670434 pm
UUID: 96d8469c-22c5-314a-b596-d9aea9735b9a
Ancestors: Morphic-ct.1943

Fixes inverse selections in StringMorphEditor. Now Shift + arrowLeft, arrowLeft, ... work here, too. The selection is already restored via #installEditorToReplace: (see TextEditor>>#stateArray). See also senders of #fixIntervalCache.

=============== Diff against Morphic-ct.1943 ===============

Item was changed:
  ----- Method: StringMorphEditor>>keyStroke: (in category 'event handling') -----
  keyStroke: evt
  	"This is hugely inefficient, but it seems to work, and it's unlikely it will ever need
  	to be any more efficient -- it's only intended to edit single-line strings."
+ 	| char priorEditor |
- 	| char priorEditor newSel |
  	(((char := evt keyCharacter) = Character enter) or: [(char = Character cr)
  			or: [char = $s and: [evt commandKeyPressed]]])
  				ifTrue: [owner doneWithEdits; acceptContents.
  	self flag: #arNote. "Probably unnecessary"
  						evt hand releaseKeyboardFocus.
  						^ self delete].
  	((char := evt keyCharacter) = Character escape
  		or: [char = $l and: [evt commandKeyPressed]]) ifTrue:   "cancel"
  		[owner cancelEdits.
  		evt hand releaseKeyboardFocus.
  		^ self delete].
  	super keyStroke: evt.
  	owner ifNil: [^self].
  	owner interimContents: self contents asString.
- 	newSel := self editor selectionInterval.
  	priorEditor := self editor.  "Save editor state"
  	self releaseParagraph.  "Release paragraph so it will grow with selection."
  	self paragraph.      "Re-instantiate to set new bounds"
+ 	self installEditorToReplace: priorEditor.  "restore editor state"!
- 	self installEditorToReplace: priorEditor.  "restore editor state"
- 	self editor selectFrom: newSel first to: newSel last.
- !

More information about the Squeak-dev mailing list