[squeak-dev] The Inbox: ST80-ct.255.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Jun 8 07:45:29 UTC 2020
Hi Marcel,
is duplication really desirable anywhere?
Hm ... ideally, I would love to rewrite such methods like this:
^ aSymbol
caseOf: {
[#wantToChange] -> [
self canDiscardEdits ifFalse: [self promptForCancel]].
[#flash] -> [controller flash].
[getTextSelector] -> [self updateDisplayContents].
"..."
{[#appendEntry]. [#appendEntryLater]} -> [
controller doOccluded: [controller appendEntry]].
"..." }
otherwise: [super update: aSymbol]
How would you think about such an extension to #caseOf:, accepting a list of cases, too? Would this be too meta? :-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 8. Juni 2020 07:19:16
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: ST80-ct.255.mcz
Hi Christoph.
Thanks. Given the overall style of this method, I would have rather duplicated those #appendEntry lines instead of using #includes:.
Best,
Marcel
Am 06.06.2020 15:48:26 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Christoph Thiede uploaded a new version of ST80 to project The Inbox:
http://source.squeak.org/inbox/ST80-ct.255.mcz
==================== Summary ====================
Name: ST80-ct.255
Author: ct
Time: 6 June 2020, 3:48:16.215278 pm
UUID: 5469be3e-28ef-c54e-952c-674500374c05
Ancestors: ST80-nice.254
Fix Transcript in MVC projects if preference 'Force transcript updates to screen' is disabled.
Thanks to Marcel (mt) for the hint!
=============== Diff against ST80-nice.254 ===============
Item was changed:
----- Method: PluggableTextView>>update: (in category 'updating') -----
update: aSymbol
"Refer to the comment in View|update:. Do nothing if the given symbol does not match any action. "
aSymbol == #wantToChange ifTrue:
[self canDiscardEdits ifFalse: [self promptForCancel]. ^ self].
aSymbol == #flash ifTrue: [^ controller flash].
aSymbol == getTextSelector ifTrue: [^ self updateDisplayContents].
aSymbol == getSelectionSelector ifTrue: [^ self setSelection: self getSelection].
aSymbol == #clearUserEdits ifTrue: [^ self hasUnacceptedEdits: false].
(aSymbol == #autoSelect and: [getSelectionSelector ~~ nil]) ifTrue:
[ParagraphEditor abandonChangeText. "no replacement!!"
^ controller setSearch: model autoSelectString;
againOrSame: true].
+ (#(#appendEntry appendEntryLater) includes: aSymbol) ifTrue:
- aSymbol == #appendEntry ifTrue:
[^ controller doOccluded: [controller appendEntry]].
aSymbol == #clearText ifTrue:
[^ controller doOccluded:
[controller changeText: Text new]].
aSymbol == #bs ifTrue:
[^ controller doOccluded:
[controller bsText]].
aSymbol == #codeChangedElsewhere ifTrue:
[^ self hasEditingConflicts: true].
aSymbol == #saveContents ifTrue:
[^self controller saveContentsInFile].
aSymbol == #close ifTrue:
[^self topView controller closeAndUnscheduleNoTerminate].
aSymbol == #acceptChanges ifTrue:
[^ self controller accept].
aSymbol == #revertChanges ifTrue:
[^ self controller cancel].!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200608/7106c7bd/attachment.html>
More information about the Squeak-dev
mailing list
|