[squeak-dev] The Trunk: Graphics-mt.509.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Apr 17 12:46:32 UTC 2022

Marcel Taeumel uploaded a new version of Graphics to project The Trunk:

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

Name: Graphics-mt.509
Author: mt
Time: 17 April 2022, 2:46:24.835818 pm
UUID: 349b51e3-cfa4-8545-bb28-0797222aafdb
Ancestors: Graphics-mt.508

Fixes (older) regression in paragraph recomposition concerning line-break characters at the end of the text.

Thanks to Tim (tcj) for reproducing this issue!

=============== Diff against Graphics-mt.508 ===============

Item was added:
+ ----- Method: CompositionScanner>>atEnd (in category 'testing') -----
+ atEnd
+ 	^ lastIndex = text size!

Item was added:
+ ----- Method: CompositionScanner>>doesTheLineBreakAfterLastChar (in category 'testing') -----
+ doesTheLineBreakAfterLastChar
+ 	^nextIndexAfterLineBreak > text size!

Item was removed:
- ----- Method: CompositionScanner>>doesTheLineBreaksAfterLastChar (in category 'accessing') -----
- doesTheLineBreaksAfterLastChar
- 	^nextIndexAfterLineBreak > text size!

Item was changed:
  ----- Method: TextComposer>>composeLinesFrom:to:delta:into:priorLines:atY:textStyle:text:container:wantsColumnBreaks: (in category 'composing') -----
  composeLinesFrom: argStart to: argStop delta: argDelta into: argLinesCollection priorLines: argPriorLines atY: argStartY textStyle: argTextStyle text: argText container: argContainer wantsColumnBreaks: argWantsColumnBreaks
  	wantsColumnBreaks := argWantsColumnBreaks.
  	lines := argLinesCollection.
  	theTextStyle := argTextStyle.
  	theText := argText.
  	theContainer := argContainer.
  	deltaCharIndex := argDelta.
  	currCharIndex := startCharIndex := argStart.
  	stopCharIndex := argStop.
  	prevLines := argPriorLines.
  	currentY := argStartY.
  	maxRightX := theContainer left.
  	possibleSlide := stopCharIndex < theText size and: [theContainer isMemberOf: Rectangle].
  	nowSliding := false.
  	prevIndex := 1.
  	"choose an appropriate scanner - should go away soon, when they can be unified"
  	scanner := CompositionScanner new.
  	scanner text: theText textStyle: theTextStyle.
  	scanner wantsColumnBreaks: wantsColumnBreaks.
  	defaultLineHeight := scanner computeDefaultLineHeight.
  	isFirstLine := true.
  	self composeAllLines.
  	isFirstLine ifTrue: ["No space in container or empty text"
  			addNullLineWithIndex: startCharIndex
  			andRectangle: (theContainer left @ theContainer top extent: 0 at defaultLineHeight)
  	] ifFalse: [
+ 		self doesLineBreakAfterLastChar
- 		(lines last last = theText size and: [scanner doesTheLineBreaksAfterLastChar])
  			ifTrue: [self addNullLineForIndex: theText size + 1]
  	^{lines asArray. maxRightX}

Item was added:
+ ----- Method: TextComposer>>doesLineBreakAfterLastChar (in category 'private') -----
+ doesLineBreakAfterLastChar
+ 	"Answer whether we should insert a null-line at the end because theText ends with a line-break character. After a full composition, we can ask the scanner. After a partial re-composition, however, we re-use most of prevLines and thus miss any trailing null-line."
+ 	^ scanner atEnd
+ 		ifTrue: [scanner doesTheLineBreakAfterLastChar]
+ 		ifFalse: [prevLines notEmpty and: [prevLines last first > prevLines last last]]!

More information about the Squeak-dev mailing list