[Pkg] The Trunk: Morphic-eem.1784.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Oct 17 18:34:34 UTC 2021


Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1784.mcz

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

Name: Morphic-eem.1784
Author: eem
Time: 17 October 2021, 11:34:29.99006 am
UUID: 7e3f944d-18fc-4a6f-bb86-03c8037ec775
Ancestors: Morphic-mt.1783

Text editing bug fixes.
A paragraph may not have been composed when interrogated for test and/or graphic coordinates. 

A TextEditor for a Transcript may have no history but still be asked to openTypeInFor:/closeTypeIn:.

=============== Diff against Morphic-mt.1783 ===============

Item was changed:
  ----- Method: NewParagraph>>fastFindFirstLineSuchThat: (in category 'private') -----
  fastFindFirstLineSuchThat: lineBlock
  	"Perform a binary search of the lines array and return the index
  	of the first element for which lineBlock evaluates as true.
  	This assumes the condition is one that goes from false to true for
  	increasing line numbers (as, eg, yval > somey or start char > somex).
  	If lineBlock is not true for any element, return size+1."
+ 	lines ifNil:
+ 		[self composeAll].
- 	
  	^lines
  		findBinaryIndex: [ :each | 
  			(lineBlock value: each)
  				ifTrue: [ -1 ]
  				ifFalse: [ 1 ] ]
  		ifNone: [ :lower :upper | upper ]!

Item was changed:
  ----- Method: TextEditor>>closeTypeIn (in category 'typing support') -----
  closeTypeIn
  	"See comment in openTypeIn.  It is important to call closeTypeIn before executing
  	 any non-typing key, making a new selection, etc.  It is called automatically for
  	 menu commands."
  
  	| begin stop |
+ 	beginTypeInIndex ifNotNil:
+ 		[begin := beginTypeInIndex.
- 	beginTypeInIndex ifNotNil: [
- 		begin := beginTypeInIndex.
  		stop := self stopIndex.
  				
+ 		self history ifNotNil:
+ 			[:myHistory|
+ 			 myHistory current
+ 				contentsAfter: (stop <= begin
+ 					ifTrue: [self nullText]
+ 					ifFalse: [paragraph text copyFrom: begin to: stop-1]);
+ 				intervalAfter: (stop to: stop-1);
+ 				intervalBetween: (stop < begin
+ 					ifTrue: [stop to: stop-1]
+ 					ifFalse: [begin to: stop-1]);
+ 				messageToUndo: (Message selector: #undoAndReselect);
+ 				messageToRedo: (Message selector: #redoAndReselect).
+ 				
+ 			myHistory finishRemember].
- 		self history current
- 			contentsAfter: (stop <= begin
- 				ifTrue: [self nullText]
- 				ifFalse: [paragraph text copyFrom: begin to: stop-1]);
- 			intervalAfter: (stop to: stop-1);
- 			intervalBetween: (stop < begin
- 				ifTrue: [stop to: stop-1]
- 				ifFalse: [begin to: stop-1]);
- 			messageToUndo: (Message selector: #undoAndReselect);
- 			messageToRedo: (Message selector: #redoAndReselect).
- 			
- 		self history finishRemember.
  
  		beginTypeInIndex := nil]!

Item was changed:
  ----- Method: TextEditor>>openTypeInFor: (in category 'typing support') -----
  openTypeInFor: editType
  	"Set up UndoSelection to null text (to be added to by readKeyboard and backTo:),
  	 beginTypeInBlock to keep track of the leftmost backspace, and UndoParameter to tally
  	 how many deleted characters were backspaced over rather than 'cut'.
  	 You can't undo typing until after closeTypeIn."
  
+ 	beginTypeInIndex ifNil:
+ 		[beginTypeInIndex := self startIndex.
+ 		 self history ifNotNil:
+ 			[:myHistory|
+ 			myHistory beginRemember:
+ 				(TextEditorCommand new
+ 					type: editType;
+ 					contentsBefore: (self hasSelection ifTrue: [self selection] ifFalse: [self nullText]);
+ 					intervalBefore: (beginTypeInIndex to: self stopIndex-1)
+ 					yourself)]]!
- 	beginTypeInIndex ifNil: [
- 		beginTypeInIndex := self startIndex.
- 		self history beginRemember: (TextEditorCommand new
- 			type: editType;
- 			contentsBefore: (self hasSelection ifTrue: [self selection] ifFalse: [self nullText]);
- 			intervalBefore: (beginTypeInIndex to: self stopIndex-1)
- 			yourself)].!



More information about the Packages mailing list