[squeak-dev] The Trunk: Compiler-mt.470.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Feb 11 09:18:57 UTC 2022
Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.470.mcz
==================== Summary ====================
Name: Compiler-mt.470
Author: mt
Time: 11 February 2022, 10:18:56.758479 am
UUID: d9114d97-dd0f-0f4f-b4a4-2b8f0afa01ff
Ancestors: Compiler-ct.469
Complements Graphics-mt.479
=============== Diff against Compiler-ct.469 ===============
Item was changed:
----- Method: ParseNode>>printSingleComment:on:indent: (in category 'private') -----
printSingleComment: aString on: aStream indent: indent
"Print the comment string, assuming it has been indented indent tabs.
Break the string at word breaks, given the widths in the default
font, at 450 points."
| readStream word position lineBreak font wordWidth tabWidth spaceWidth lastChar |
readStream := ReadStream on: aString.
font := TextStyle default defaultFont.
+ tabWidth := TextStyle default tabWidth.
- tabWidth := TextConstants at: #DefaultTab.
spaceWidth := font widthOf: Character space.
position := indent * tabWidth.
lineBreak := 450.
[readStream atEnd]
whileFalse:
[word := self nextWordFrom: readStream setCharacter: [:lc | lastChar := lc].
wordWidth := word inject: 0 into: [:width :char | width + (font widthOf: char)].
position := position + wordWidth.
position > lineBreak
ifTrue:
[aStream skip: -1; crtab: indent.
position := indent * tabWidth + wordWidth + spaceWidth.
lastChar = Character cr
ifTrue: [[readStream peekFor: Character tab] whileTrue].
word isEmpty ifFalse: [aStream nextPutAll: word; space]]
ifFalse:
[aStream nextPutAll: word.
readStream atEnd
ifFalse:
[position := position + spaceWidth.
aStream space].
lastChar = Character cr
ifTrue:
[aStream skip: -1; crtab: indent.
position := indent * tabWidth.
[readStream peekFor: Character tab] whileTrue]]]!
More information about the Squeak-dev
mailing list
|