[squeak-dev] Re: Formatting?

karl ramberg karlramberg at gmail.com
Wed Jun 1 13:22:45 UTC 2016


On Wed, Jun 1, 2016 at 12:47 PM, Bert Freudenberg <bert at freudenbergs.de>
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”.
>
> - Bert -
>

Or search could ignore leading colon

Best,
Karl

>
>
> > On 31.05.2016, at 23:58, Chris Muller <asqueaker at gmail.com> 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 at gmx.de> wrote:
> >>
> >> On 31.05.2016, at 21:26, commits at source.squeak.org 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
> >
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160601/0bac5112/attachment.htm


More information about the Squeak-dev mailing list