The Trunk: Morphic-mt.1493.mcz

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

The Trunk: Morphic-mt.1493.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/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]!