[squeak-dev] The Inbox: Morphic-ct.1586.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Nov 10 15:07:11 UTC 2019


Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Sonntag, 10. November 2019 16:06:26
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Morphic-ct.1586.mcz

A new version of Morphic was added to project The Inbox:

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

Name: Morphic-ct.1586
Author: ct
Time: 10 November 2019, 4:06:17.228559 pm
UUID: d752eb23-2116-0945-b043-aff08fed94fd
Ancestors: Morphic-mt.1584

Proposal: Style printIt results as a pluggable link that can be clicked to inspect the result.

To enable this behavior, this commit also extends #insertAndSelect:at: to allow for inserting both strings and texts.

=============== Diff against Morphic-mt.1584 ===============

Item was changed:
  ----- Method: PluggableTextMorph>>printIt (in category 'menu commands') -----
         | oldEditor |
         textMorph editor selectFrom: selectionInterval first to: selectionInterval last;
                                                 model: model.  "For, eg, evaluateSelection"
         textMorph handleEdit: [(oldEditor := textMorph editor) evaluateSelectionAndDo:
                 [:result |
                 selectionInterval := oldEditor selectionInterval.
                 textMorph installEditorToReplace: oldEditor.
+                textMorph handleEdit: [ oldEditor afterSelectionInsertAndSelect:
+                        (oldEditor printTextFor: result)].
-                textMorph handleEdit: [oldEditor afterSelectionInsertAndSelect: result printString].
                 selectionInterval := oldEditor selectionInterval.

                 textMorph editor selectFrom: selectionInterval first to: selectionInterval last.
                 self scrollSelectionIntoView]]!

Item was changed:
  ----- Method: TextEditor>>afterSelectionInsertAndSelect: (in category 'new selection') -----
+ afterSelectionInsertAndSelect: aStringOrText
- afterSelectionInsertAndSelect: aString

+        self insertAndSelect: aStringOrText at: self stopIndex !
-        self insertAndSelect: aString at: self stopIndex !

Item was changed:
  ----- Method: TextEditor>>insertAndSelect:at: (in category 'new selection') -----
+ insertAndSelect: aStringOrText at: anInteger
- insertAndSelect: aString at: anInteger

+        aStringOrText isString ifTrue: [
+                ^ self
+                        insertAndSelect: (Text string: aStringOrText attributes: emphasisHere)
+                        at: anInteger].
-        self closeTypeIn.

+        self closeTypeIn.
         self selectInvisiblyFrom: anInteger to: anInteger - 1.
         self openTypeIn.

                 replace: self selectionInterval
+                with: (Text string: ' ' attributes: emphasisHere), aStringOrText
-                with: (Text string: (' ', aString) attributes: emphasisHere)
                 and: [].
         self closeTypeIn.!

Item was changed:
  ----- Method: TextEditor>>printIt (in category 'do-its') -----

         self evaluateSelectionAndDo: [:result |
                 (model respondsTo: #printIt:result:)
                         ifTrue: [model
                                 perform: #printIt:result:
                                 with: self selection
                                 with: result]
+                        ifFalse: [self afterSelectionInsertAndSelect: (self printTextFor: result)]]!
-                        ifFalse: [self afterSelectionInsertAndSelect: result printString]]!

Item was added:
+ ----- Method: TextEditor>>printTextFor: (in category 'do-its') -----
+ printTextFor: anObject
+        ^ Text
+                string: anObject printString
+                attributes: {PluggableTextAttribute evalBlock: [anObject inspect]}!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191110/f1f9c581/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 70473 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191110/f1f9c581/attachment-0001.png>

More information about the Squeak-dev mailing list