[squeak-dev] The Inbox: Morphic-mt.1493.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jul 20 07:59:30 UTC 2019
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]!
More information about the Squeak-dev
mailing list
|