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

K K Subbu kksubbu.ml at gmail.com
Fri May 17 09:59:45 UTC 2019


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 <asqueaker at gmail.com 
> <mailto:asqueaker at gmail.com>> a écrit :
> 
>     I had that exact same question.   Probably so...
> 
>     On Wed, May 15, 2019 at 2:15 AM Marcel Taeumel
>     <marcel.taeumel at hpi.de <mailto:marcel.taeumel at hpi.de>> wrote:
>      >
>      > We should check all possible line-end characters, right?
>      >
>      > Am 15.05.2019 00:53:20 schrieb commits at source.squeak.org
>     <mailto:commits at source.squeak.org> <commits at source.squeak.org
>     <mailto: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 < self=""
>     stopblock="">
>      >
>      >
>      >
> 
> 
> 



More information about the Squeak-dev mailing list