[squeak-dev] The Inbox: Morphic-mt.1493.mcz

Christoph Thiede christoph.thiede at outlook.de
Sat Jul 20 19:02:57 UTC 2019


Hi Marcel,

thank your for taking up my proposal! Allow me one question, why did you decide not to track hasUnacceptedEdits directly in the TextMorphForEditView? I think this would keep the changes small and not even require additional accessors, and in Editor>>#userHasEdited, #hasUnacceptedEdits: apparently is always called on the TextMorphForEditView. Also, aren't there any other possible clients of TextMorphForEditView beside PluggableTextMorph? Would be great to here the reasons!

Have a nice weekend,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Samstag, 20. Juli 2019 09:59 Uhr
An: squeak-dev at lists.squeakfoundation.org <squeak-dev at lists.squeakfoundation.org>
Betreff: [squeak-dev] The Inbox: Morphic-mt.1493.mcz

A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-mt.1493.mcz

==================== Summary ====================

Name: Morphic-mt.1493
Author: mt
Time: 20 July 2019, 9:59:23.026728 am
UUID: 22c8cff7-de9c-8348-9a19-4cdd14621253
Ancestors: Morphic-mt.1492

Finally have a robust version for the #textEdited: callback in pluggable text morphs.

Thanks to Christoph Thiede for the idea!

=============== Diff against Morphic-mt.1492 ===============

Item was changed:
  ScrollPane subclass: #PluggableTextMorph
+        instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits hasUserEdited askBeforeDiscardingEdits selectionInterval hasEditingConflicts editTextSelector wantsWrapBorder'
-        instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts editTextSelector wantsWrapBorder'
         classVariableNames: 'AdornmentCache SimpleFrameAdornments SoftLineWrap VisualWrapBorder VisualWrapBorderLimit'
         poolDictionaries: ''
         category: 'Morphic-Pluggable Widgets'!

Item was changed:
+ ----- Method: PluggableTextMorph>>hasUnacceptedEdits (in category 'unaccepted edits') -----
- ----- Method: PluggableTextMorph>>hasUnacceptedEdits (in category 'dependents access') -----
  hasUnacceptedEdits
         "Return true if this view has unaccepted edits."

         ^ hasUnacceptedEdits!

Item was changed:
  ----- Method: PluggableTextMorph>>hasUnacceptedEdits: (in category 'unaccepted edits') -----
+ hasUnacceptedEdits: wasJustEdited
+
+        wasJustEdited = hasUnacceptedEdits ifFalse: [
+                hasUnacceptedEdits := wasJustEdited.
- hasUnacceptedEdits: aBoolean
-        "Set the hasUnacceptedEdits flag to the given value. "
-        aBoolean == hasUnacceptedEdits ifFalse:
-                [hasUnacceptedEdits := aBoolean.
                 self changed].
+
+        wasJustEdited
+                ifTrue: [self hasUserEdited: true]
+                ifFalse: [self hasEditingConflicts: false].!
-        aBoolean ifFalse: [hasEditingConflicts := false]!

Item was added:
+ ----- Method: PluggableTextMorph>>hasUserEdited (in category 'unaccepted edits') -----
+ hasUserEdited
+
+        ^ hasUserEdited!

Item was added:
+ ----- Method: PluggableTextMorph>>hasUserEdited: (in category 'unaccepted edits') -----
+ hasUserEdited: aBoolean
+
+        hasUserEdited := aBoolean.!

Item was changed:
  ----- Method: TextMorphForEditView>>keyStroke: (in category 'event handling') -----
  keyStroke: evt
         | view |

         editView deleteBalloon.
         self editor model: editView model.  "For evaluateSelection"
         view := editView.  "Copy into temp for case of a self-mutating doit"
         (acceptOnCR and: [evt keyCharacter = Character cr])
                 ifTrue: [^ self editor accept].
+
+        view hasUserEdited: false.
         super keyStroke: evt.
         view scrollSelectionIntoView.

+        view hasUserEdited
+                ifTrue: [       view textEdited: self contents].!
-        "Make a cheap check and guess editing. (Alternative would be to copy the old contents and then compare them against the new ones. Maybe add a better hook in the TextEditor."
-        (self readOnly not and: [self eventCharacterModifiesText: evt keyCharacter])
-                ifTrue: [view textEdited: self contents]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190720/79f59c2b/attachment.html>


More information about the Squeak-dev mailing list