[squeak-dev] The Inbox: Compiler-cmm.480.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 13 20:58:04 UTC 2022


Chris Muller uploaded a new version of Compiler to project The Inbox:
http://source.squeak.org/inbox/Compiler-cmm.480.mcz

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

Name: Compiler-cmm.480
Author: cmm
Time: 13 July 2022, 3:58:02.487109 pm
UUID: 0af0343b-cf23-427a-8bff-1b45941699dc
Ancestors: Compiler-eem.479

Preserve hand-crafted formatting of comments.

=============== Diff against Compiler-eem.479 ===============

Item was changed:
  ----- Method: ParseNode>>printSingleComment:on:indent: (in category 'private') -----
  printSingleComment: aString on: aStream indent: indent 
+ 	"Preserve hand-crafted formatting of comments."
+ 	aStream nextPutAll: aString!
- 	"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.
- 	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