The Inbox: Morphic-cmm.1489.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-cmm.1489.mcz

commits-2
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 < self stopBlock top]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

marcel.taeumel
We should check all possible line-end characters, right?

Am 15.05.2019 00:53:20 schrieb [hidden email] <[hidden email]>:

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 < self="" stopblock="">




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

Chris Muller-3
I had that exact same question.   Probably so...

On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel <[hidden email]> wrote:

>
> We should check all possible line-end characters, right?
>
> Am 15.05.2019 00:53:20 schrieb [hidden email] <[hidden email]>:
>
> 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 < self="" stopblock="">
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

Nicolas Cellier
includesAnyOf: String crlf

Le mer. 15 mai 2019 à 21:16, Chris Muller <[hidden email]> a écrit :
I had that exact same question.   Probably so...

On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel <[hidden email]> wrote:
>
> We should check all possible line-end characters, right?
>
> Am 15.05.2019 00:53:20 schrieb [hidden email] <[hidden email]>:
>
> 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 < self="" stopblock="">
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

marcel.taeumel
Maybe use CharacterSet class >> #crlf ? Or add #lineEndCharacters? Like #nonSeparators etc.

Best,
Marcel

Am 15.05.2019 21:28:43 schrieb Nicolas Cellier <[hidden email]>:

includesAnyOf: String crlf

Le mer. 15 mai 2019 à 21:16, Chris Muller <[hidden email]> a écrit :
I had that exact same question.   Probably so...

On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel <[hidden email]> wrote:
>
> We should check all possible line-end characters, right?
>
> Am 15.05.2019 00:53:20 schrieb [hidden email] <[hidden email]>:
>
> 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 < self="" stopblock="">
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

K K Subbu
In reply to this post by Nicolas Cellier
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 <[hidden email]
> <mailto:[hidden email]>> a écrit :
>
>     I had that exact same question.   Probably so...
>
>     On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel
>     <[hidden email] <mailto:[hidden email]>> wrote:
>      >
>      > We should check all possible line-end characters, right?
>      >
>      > Am 15.05.2019 00:53:20 schrieb [hidden email]
>     <mailto:[hidden email]> <[hidden email]
>     <mailto:[hidden email]>>:
>      >
>      > 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 < self=""
>     stopblock="">
>      >
>      >
>      >
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

marcel.taeumel
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 <[hidden email]>:

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 [hidden email]
> <>
> >:
> >
> > 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 < self="">
> stopblock="">
> >
> >
> >
>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1489.mcz

Chris Muller-3
In reply to this post by marcel.taeumel
> Maybe use CharacterSet class >> #crlf ?

I like this ^^^ since it utilizes an existing object in the system, so
a lot less garbage created over String crlf.  Thanks for the tip.

Since this is such a small fix I'll piggyback it with my next Morphic change.