[squeak-dev] The Trunk: Morphic-cmm.610.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Feb 15 03:16:18 UTC 2012


Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.610.mcz

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

Name: Morphic-cmm.610
Author: cmm
Time: 14 February 2012, 9:14:20.48 pm
UUID: d8725b91-2f26-4c63-b9a3-05601133a3ab
Ancestors: Morphic-dtl.609

- Avoid index-out-of-bounds error when a TextMorph which set to avoid-occlusions, composeAllRectangles.

=============== Diff against Morphic-dtl.609 ===============

Item was changed:
  ----- Method: TextComposer>>composeAllRectangles: (in category 'as yet unclassified') -----
  composeAllRectangles: rectangles
  
  	| charIndexBeforeLine numberOfLinesBefore reasonForStopping |
  
  	actualHeight := defaultLineHeight.
  	charIndexBeforeLine := currCharIndex.
  	numberOfLinesBefore := lines size.
  	reasonForStopping := self composeEachRectangleIn: rectangles.
  
  	currentY := currentY + actualHeight.
  	currentY > theContainer bottom ifTrue: [
  		"Oops -- the line is really too high to fit -- back out"
  		currCharIndex := charIndexBeforeLine.
  		lines size - numberOfLinesBefore timesRepeat: [lines removeLast].
  		^self
  	].
  	
  	"It's OK -- the line still fits."
  	maxRightX := maxRightX max: scanner rightX.
+ 	1 to: rectangles size - 1 do: [ :i | |lineIndex|
- 	1 to: rectangles size - 1 do: [ :i |
  		"Adjust heights across rectangles if necessary"
+ 		lineIndex:=lines size - rectangles size + i.
+ 		(lines size between: 1 and: lineIndex) ifTrue: 
+ 			[(lines at: lineIndex)
+ 				lineHeight: lines last lineHeight
+ 				baseline: lines last baseline] 
- 		(lines at: lines size - rectangles size + i)
- 			lineHeight: lines last lineHeight
- 			baseline: lines last baseline
  	].
  	isFirstLine := false.
  	reasonForStopping == #columnBreak ifTrue: [^nil].
  	currCharIndex > theText size ifTrue: [
  		^nil		"we are finished composing"
  	].
  	!



More information about the Squeak-dev mailing list