--- a/Explainer.st Tue May 17 00:06:03 2016 +0200
+++ b/Explainer.st Wed May 18 10:37:04 2016 +0200
@@ -569,7 +569,7 @@
"retrieve a desription of a method
(if possible and there is one; otherwise, return nil)"
- |methodDecl methodSource methodComment lines maxNumLines |
+ |methodDecl methodSource methodComment lines maxNumLines firstIndent|
self withWaitCursorDo:[
SourceCodeManagerError handle:[:ex |
@@ -581,27 +581,47 @@
].
methodComment isEmptyOrNil ifTrue:[
^ methodDecl
+ ].
+ methodComment := methodComment asStringCollection.
+ firstIndent := 0.
+ methodComment size > 1 ifTrue:[
+ |line2|
+ line2 := methodComment at:2.
+ line2 notEmpty ifTrue:[
+ firstIndent := line2 indexOfNonSeparator - 1 max:0.
+ ].
].
+ methodComment := methodComment
+ collect:[:line |
+ |l|
+ l := line withTabsExpanded.
+ l indexOfNonSeparator > firstIndent ifTrue:[
+ l := l copyFrom:firstIndent+1
+ ].
+ l
+ ].
+ methodComment := methodComment asString.
+
^ methodDecl , Character cr ,
(methodComment withColor:(UserPreferences current commentColor)).
- methodComment isEmptyOrNil ifTrue:[^ nil].
-
- lines := methodComment asStringCollection.
- maxNumLines := 1.
-true ifTrue:[
- methodComment := (lines copyToMax:maxNumLines) asString.
- maxNumLines := 5.
-] ifFalse:[
- methodComment := lines first.
- methodComment := methodComment withoutSeparators.
- (methodComment endsWith:',') ifTrue:[ methodComment := methodComment copyButLast:1].
- methodComment := methodComment withoutSeparators.
-].
- (lines size > maxNumLines) ifTrue:[
- methodComment := methodComment , '\...' withCRs
- ].
- ^ (methodComment) withColor:(UserPreferences current commentColor).
+"/ methodComment isEmptyOrNil ifTrue:[^ nil].
+"/
+"/ lines := methodComment asStringCollection.
+"/ maxNumLines := 1.
+"/true ifTrue:[
+"/ methodComment := (lines copyToMax:maxNumLines) asString.
+"/ maxNumLines := 5.
+"/] ifFalse:[
+"/ methodComment := lines first.
+"/ methodComment := methodComment withoutSeparators.
+"/ (methodComment endsWith:',') ifTrue:[ methodComment := methodComment copyButLast:1].
+"/ methodComment := methodComment withoutSeparators.
+"/].
+"/ (lines size > maxNumLines) ifTrue:[
+"/ methodComment := methodComment , '\...' withCRs
+"/ ].
+"/ ^ (methodComment) withColor:(UserPreferences current commentColor).
"Created: / 14-09-2006 / 14:11:58 / cg"
"Modified (comment): / 30-04-2016 / 16:17:18 / cg"