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

Marcel Taeumel marcel.taeumel at hpi.de
Thu Jul 14 06:35:52 UTC 2022


Hi all --

I have no objection here. Actually, a strong +1 because the current form is incompatible with scale factor larger than 100% and thus high-dpi.

If one would reformat comments, I would strongly suggest to NOT define line breaks via pixels but only based on a sane lines-per-character default. Maybe -- and only because Squeak uses proportional fonts by default -- use the text-layout algorithm to figure out the breaks. See Text >> #withNoLineLongerThan: so learn more about how this could work for the pretty-printer as well.

Best,
Marcel
Am 13.07.2022 22:58:12 schrieb commits at source.squeak.org <commits at source.squeak.org>:
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]]]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220714/9fdf603c/attachment.html>


More information about the Squeak-dev mailing list