[squeak-dev] The Trunk: Morphic-nice.1636.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 7 00:01:04 UTC 2020

Nicolas Cellier uploaded a new version of Morphic to project The Trunk:

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

Name: Morphic-nice.1636
Author: nice
Time: 7 March 2020, 1:00:59.396856 am
UUID: 605fc13a-057a-4927-bde8-21cfdd770f3e
Ancestors: Morphic-nice.1635, Morphic-ct.1619

Merge Morphic-ct.1619 and fix undo bug when cmd+d immediately follow a backspace

We must first close the TypeIn (closeTypeIn) before changing the selection (even invisibly), otherwise a wrong selection is memorized in the undo history.

Note that the merge does remove the mysterious oldEditor/selectionInterval dance from PluggableTextMorph>>#printIt (self flag: #fixIntervalCache).
I do not understand the problem it tries to fix (unless the purpose was to workaround such undo bug, which it did not).

	Proposal: Unify all doIt related operations in PluggableTextMorph by delegating them to the editor.

This also fixes the fact that certain hooks such as #printIt:result:, #inspectIt:result:, or #exploreIt:result: were ignored when triggering the operation via the textmorph menu instead of shortcut. This is not an expected behavior, is it?

=============== Diff against Morphic-nice.1635 ===============

Item was changed:
  ----- Method: PluggableTextMorph>>doIt (in category 'menu commands') -----
+ 	^ self handleEdit: [textMorph editor doIt]!
- 	^self handleEdit: [textMorph editor evaluateSelection]!

Item was changed:
  ----- Method: PluggableTextMorph>>exploreIt (in category 'menu commands') -----
+ 	^ self handleEdit: [textMorph editor exploreIt]!
- 	self handleEdit:
- 		[textMorph editor evaluateSelectionAndDo: [:result | result explore]].!

Item was changed:
  ----- Method: PluggableTextMorph>>inspectIt (in category 'menu commands') -----
+ 	^ self handleEdit: [textMorph editor inspectIt]!
- 	self handleEdit:
- 		[textMorph editor evaluateSelectionAndDo: [:result | result inspect]]!

Item was changed:
  ----- Method: PluggableTextMorph>>printIt (in category 'menu commands') -----
+ 	^ self handleEdit: [textMorph editor printIt]!
- 	| oldEditor |
- 	textMorph editor selectFrom: selectionInterval first to: selectionInterval last;
- 						model: model.  "For, eg, evaluateSelection"
- 	textMorph handleEdit: [(oldEditor := textMorph editor) evaluateSelectionAndDo:
- 		[:result |
- 		self flag: #fixIntervalCache. "mt: We should find a better design for discarding unused text editors in text morphs and restoring them on demand."
- 		selectionInterval := oldEditor markIndex to: oldEditor pointIndex -1.
- 		textMorph installEditorToReplace: oldEditor.
- 		textMorph handleEdit: [oldEditor afterSelectionInsertAndSelect: result printString].
- 		selectionInterval := oldEditor markIndex to: oldEditor pointIndex -1.
- 		textMorph editor selectFrom: selectionInterval first to: selectionInterval last.
- 		self scrollSelectionIntoView]]!

Item was changed:
  ----- Method: TextEditor>>selectFrom:to: (in category 'new selection') -----
  selectFrom: start to: stop
+ 	self closeTypeIn.
  	"Select the specified characters inclusive."
  	self selectInvisiblyFrom: start to: stop.
- 	self closeTypeIn.
  	self storeSelectionInParagraph.
  	"Preserve current emphasis if selection is empty"
  	stop > start ifTrue: [
  		self setEmphasisHere ]!

More information about the Squeak-dev mailing list