Hi Karl,
Hack sounds like a good name to me.
You can't imagine what a nest of stateful twisted tricky code modified during 30 years I had to patiently untangle...
But it's very hard to remember all the details 3 years after...
Fortunately, we have an electronic memory to assist us:
If I dig thru the [The Trunk] commits threads in the mailing list it seems that on 2 October 2013:
- the hack was already named "hack" before Graphics-nice.243.mcz- it was in generic code (for both Morphic/ST80) but dedicated to ST80 only- so I ported it back to a ST80 specific scanner in ST80-nice.152.mcz
So, despite my initials and my opinion, the name "hack" here is not my own production, just a copy/paste ;)Now that trunk MC server also has a longer memory, you can see the text already present in CharacterBlockcanner>>crossedX version ar 12/15/2001.And I would not be much surprised that most code in this area comes from Xerox era, and Dan Ingalls himself.2016-10-27 11:04 GMT+02:00 karl ramberg <karlramberg@gmail.com>:Should the comment be changed here? Or is it still a hack ?Best,KarlOn Thu, Oct 27, 2016 at 2:43 AM, <commits@source.squeak.org> wrote:Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.220.mcz
==================== Summary ====================
Name: ST80-nice.220
Author: nice
Time: 27 October 2016, 2:43:25.251747 am
UUID: e617501e-764e-4c9c-8c0c-a2a559e84940
Ancestors: ST80-tfel.219
Remove an old Transcript show: remnant from horrorful text selection debug session.
=============== Diff against ST80-tfel.219 ===============
Item was changed:
----- Method: CharacterBlockScannerForMVC>>crossedX (in category 'stop conditions') -----
crossedX
characterIndex == nil ifFalse: [
"If the last character of the last line is a space,
and it crosses the right margin, then locating
the character block after it is impossible without this hack."
+ characterIndex > text size ifTrue: [
- characterIndex > text size ifTrue: [Transcript cr; show:'here'.
lastIndex := characterIndex.
characterPoint := (nextLeftMargin ifNil: [leftMargin]) @ (destY + line lineHeight).
^true]].
^super crossedX!