Workspace.st
changeset 5865 e3e40eabdebc
parent 5731 00e37b96afea
child 5878 bf8ff30c58d5
--- a/Workspace.st	Tue Sep 13 16:09:20 2016 +0200
+++ b/Workspace.st	Wed Sep 14 07:10:45 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1762,7 +1764,7 @@
     ] ifFalse:[
         codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators.
     ].
-    idx := codeToEvaluate indexOf:'»'.
+    idx := codeToEvaluate indexOf:'»'.
     idx ~~ 0 ifTrue:[
         selector := (codeToEvaluate copyFrom:idx+1) withoutSeparators string.
         (selector startsWith:'#') ifTrue:[
@@ -2007,8 +2009,8 @@
                 ('Implementors of It'           browseImplementorsOfIt  ImplementorsOfIt    )
                 ('References to It'             browseReferencesToIt                        )
 "/                ('Classes Containing It in Name'    browseClassesContainingItInName           )
-"/                ('Methods Contaníning It in Name'   browseMethodsContainingItInName           )
-"/                ('Methods Contaníning It in Source' browseMethodsContainingItInSource         )
+"/                ('Methods Contaníning It in Name'   browseMethodsContainingItInName           )
+"/                ('Methods Contaníning It in Source' browseMethodsContainingItInSource         )
                 ('-'                                                                )
                 ('TimeIt'               timeIt                                      )
                 ('SpyOnIt'              spyOnIt                                     ))
@@ -2290,15 +2292,18 @@
      Show a wait-cursor, evaluate the code with profier on it,
      and finally restore the cursor. Show profile data as per profiler"
 
-    |code|
-
+    |code codeToRun|
+        
+    codeToRun := self selectionOrTextOfCursorLine.
+    (codeToRun isEmptyOrNil or:[codeToRun isBlank]) ifTrue:[^ self].
+    
     compilerClass == (Smalltalk at:#Compiler) ifFalse:[
-	"sigh - this measurement will include the time to compile - sigh"
-	aProfiler spyDetailedOn:[ self doIt ].
-	^ self.
+        "sigh - this measurement will include the time to compile - sigh"
+        aProfiler spyDetailedOn:[ self doIt ].
+        ^ self.
     ].
 
-    code := aProfiler name,' spyDetailedOn:[' , (self selectionOrTextOfCursorLine), ']'.
+    code := aProfiler name,' spyDetailedOn:[' , codeToRun, ']'.
     self do:code withValueDo:[:value| ].
 !