The Trunk: Morphic-ct.1606.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-ct.1606.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ct.1606.mcz

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

Name: Morphic-ct.1606
Author: ct
Time: 7 December 2019, 4:53:17.106431 pm
UUID: 83ec1d59-dfa2-ca40-806d-809e76232100
Ancestors: Morphic-mt.1604

Restore original selection interval after any kind of do-it.

This is important if you print-it the following and skip the compiler hint:

| x |
x.
2

Before this commit, the answer was displayed just after x, not at the end of the snippet.

=============== Diff against Morphic-mt.1604 ===============

Item was changed:
  ----- Method: TextEditor>>evaluateSelectionAndDo: (in category 'do-its') -----
  evaluateSelectionAndDo: aBlock
  "Treat the current selection as an expression; evaluate it and invoke aBlock with the result."
+ | selectionInterval result rcvr ctxt |
- | result rcvr ctxt |
  self lineSelectAndEmptyCheck: [^ nil].
+ selectionInterval := self selectionInterval.
 
  (model respondsTo: #evaluateExpression:) ifTrue: [
  ^ aBlock value: (model perform: #evaluateExpression: with: self selection)].
 
  (model respondsTo: #doItReceiver)
  ifTrue: [ rcvr := model doItReceiver.
  ctxt := model doItContext]
  ifFalse: [rcvr := ctxt := nil].
  result := [
  rcvr class evaluatorClass new
  evaluate: self selectionAsStream
  in: ctxt
  to: rcvr
  environment: (model environment ifNil: [Smalltalk globals])
  notifying: self
  ifFail: [morph flash. ^ nil]
  logged: true.
  ]
  on: OutOfScopeNotification
  do: [ :ex | ex resume: true].
+ self selectInterval: selectionInterval.
+
-
  (model respondsTo: #expressionEvaluated:result:) ifTrue: [
  model perform: #expressionEvaluated:result: with: self selection with: result].
 
  ^aBlock value: result!