[squeak-dev] The Inbox: Morphic-cmm.1489.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri May 17 10:13:03 UTC 2019


Hi Subbu,

I don't think so because if you call #indent:, you expect it to indent. Adding that check within #indent: would decrease its potential re-use, e.g., in tests. You don't even need the keyboard event as an argument.

Best,
Marcel
Am 17.05.2019 11:59:59 schrieb K K Subbu <kksubbu.ml at gmail.com>:
hasMultipleLinesSelected is called from the keyboard handler only. I
don't see any other senders:

typedChar == Character tab ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [self outdent: aKeyboardEvent. ^ true]
ifFalse: [self hasMultipleLinesSelected
ifTrue: [self indent: aKeyboardEvent. ^ true]]].

Wouldn't it be better to just let the Editor handle lines within indent
and outdent method instead of leaking its representation into the
keyboard event handler? E.g.

typedChar == Character tab ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [self outdent: aKeyboardEvent. ^ true]
ifFalse: [self indent: aKeyboardEvent. ^ true]].

TextEditor>>indent:
self includesAnyOf: String crlf ifTrue: .. ifFalse: ...
or
self linesDo: [:line | ... ]

Regards .. Subbu

On 16/05/19 12:58 AM, Nicolas Cellier wrote:
> includesAnyOf: String crlf
>
> Le mer. 15 mai 2019 à 21:16, Chris Muller
> > a écrit :
>
> I had that exact same question. Probably so...
>
> On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel
> > wrote:
> >
> > We should check all possible line-end characters, right?
> >
> > Am 15.05.2019 00:53:20 schrieb commits at source.squeak.org
>
> >:
> >
> > Chris Muller uploaded a new version of Morphic to project The Inbox:
> > http://source.squeak.org/inbox/Morphic-cmm.1489.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Morphic-cmm.1489
> > Author: cmm
> > Time: 14 May 2019, 5:52:52.33191 pm
> > UUID: 7ac016ff-055b-4834-b3b3-35a7864215d0
> > Ancestors: Morphic-pre.1488
> >
> > Fix TextEditor>>#hasMultipleLinesSelected to consider actual
> lines, instead of wrapped lines.
> >
> > =============== Diff against Morphic-pre.1488 ===============
> >
> > Item was changed:
> > ----- Method: TextEditor>>hasMultipleLinesSelected (in category
> 'typing support') -----
> > hasMultipleLinesSelected
> > + ^ self selection includes: Character cr!
> > -
> > - ^ self hasSelection and: [self startBlock top
> stopblock="">
> >
> >
> >
>
>
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190517/2801189f/attachment.html>


More information about the Squeak-dev mailing list