[squeak-dev] Re: Formatting?
marcel.taeumel
Marcel.Taeumel at hpi.de
Wed Jun 1 17:23:16 UTC 2016
Eliot Miranda-2 wrote
> On Wed, Jun 1, 2016 at 3:47 AM, Bert Freudenberg <
> bert@
> >
> wrote:
>
>> The predominant style in Squeak historically has been
>>
>> coll do: [:each | each do something]
>>
>> Ken Beck uses that in his “Best Practice Patterns” too. It’s also
>> produced
>> by our formatter (but we rarely use that because it introduces weird line
>> breaks).
>>
>> I prefer this style because it seems to be most readable.
>>
>> I agree with Chris about selectability, but I’d rather fix our
>> double-click selection logic than make the code look weird.
>> Double-clicking
>> on “:foo” should only select “foo”.
>>
>
> +1000
>
>
>>
>> - Bert -
>>
>>
>> > On 31.05.2016, at 23:58, Chris Muller <
> asqueaker@
> > wrote:
>> >
>> > By "everywhere" I assume you mean the ones just inside my brackets?
>> > When block arguments are written without a space between the colon and
>> > variable name, like this:
>> >
>> > coll do: [:each|each do something]
>> >
>> > then I can't simply double-click the "each" declaration and then use
>> > Cmd+g to find further occurrences, because double-clicking it also
>> > selects the colon.
>> >
>> > So, I could write:
>> >
>> > coll do: [: each|each do something]
>> >
>> > but it looks strange to me.
>> >
>> > But also for easier expression editing. With no space, it is harder
>> > to select the inner expression via double clicking just inside the
>> > opening bracket; because a space there affords the user more width to
>> > hit the expression than the narrow colon.
>> >
>> > This effect can be verified on a computer with touch pad with
>> > **separate buttons** (e.g., able to double-click without moving the
>> > mouse even one pixel). 1) put a space there, 2) place mouse about
>> > halfway into width of the space. 3) Without touching touch pad,
>> > double-click to ensure expression is selected. 4) Now single-click to
>> > deselect expression. 5) Now press [Delete] to delete the space. 6)
>> > Without touching touch pad, again double-click in the exact same spot.
>> > The colon is selected instead of the expression.
>> >
>> > On Tue, May 31, 2016 at 4:42 PM, Tobias Pape <
> Das.Linux@
> > wrote:
>> >>
>> >> On 31.05.2016, at 21:26,
> commits at .squeak
> wrote:
>> >>
>> >>
>> >>> Item was changed:
>> >>> ----- Method: PluggableTextMorphPlus>>drawBalloonTextOn: (in category
>> 'drawing') -----
>> >>> + drawBalloonTextOn: aCanvas
>> >>> - drawBalloonTextOn: aCanvas
>> >>> "Show balloon text in the text morph if it has no contents."
>> >>> + textMorph contents ifNotEmpty: [ ^ self ].
>> >>> + ([ self balloonText ]
>> >>> + on: Error
>> >>> + do: [ : err | 'error in balloonText' ]) ifNotNil:
>> >>> + [ : text | aCanvas
>> >>> -
>> >>> - textMorph contents ifNotEmpty: [^ self].
>> >>> -
>> >>> - self balloonText ifNotNil: [:text |
>> >>> - aCanvas
>> >>> drawString: text
>> >>> + in: (self innerBounds insetBy: (5 @ 2 corner: 0
>> @ 0))
>> >>> + font: textMorph textStyle defaultFont "I want
>> italic here"
>> >>> + color: (Color gray: 0.7) ]!
>> >>> - in: (self innerBounds insetBy: (5 at 2 corner: 0 at 0
>> ))
>> >>> - font: textMorph textStyle defaultFont
>> >>> - color: (Color gray: 0.7)].!
>> >>
>> >> Just curious, why are you adding spaces everywhere?
>> >> :)
>> >> Best regards
>> >> -toibas
>> >
>>
>>
>>
>>
>>
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
You saw that code when I made infinite text undo working again. It is in
Editor >> #selectWord and #selectWordLeftDelimiters:rightDelimiters:. You
cannot just add $':' to the list of delimiters because that would complicate
symbol selection. So, the steps would be look for more context whether you
want to select "#open:with:" with clicks and also "each" from "...[ :each
|..."
Best,
Marcel
--
View this message in context: http://forum.world.st/Formatting-was-Re-squeak-dev-The-Trunk-ToolBuilder-Morphic-cmm-164-mcz-tp4898446p4898723.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|