*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 29 Oct 2009 15:18:13 +0100
changeset 1077 6ac6f64936f8
parent 1076 2d6b2399e42c
child 1078 e55c0b1c7670
*** empty log message ***
keyboardMacros.rc
--- a/keyboardMacros.rc	Thu Oct 29 15:04:31 2009 +0100
+++ b/keyboardMacros.rc	Thu Oct 29 15:18:13 2009 +0100
@@ -278,7 +278,7 @@
 "/ macro to convert selection to uppercaseFirst words
 "/
 macros at:#ConvertSelectionToUppercaseFirst put:'
-	"to-lower selected text"
+	"to-upperFirst selected text"
 
 	|line1 line2|
 
@@ -329,7 +329,7 @@
 '.
 
 macros at:#ConvertSelectionToUppercase put:'
-	"to-lower selected text"
+	"to-upper selected text"
 
 	|line1 line2|
 
@@ -387,7 +387,7 @@
 	line1 notNil ifTrue:[
 	    line1 to:line2 do:[:lineNr |
 		|line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst
-		 makeLowercase makeUppercase makeUppercaseFirst|
+		 makeLowercase makeUppercase makeUppercaseFirst makeLowercaseFirst|
 
 		line := (self listAt:lineNr) copy.
 		line size > 0 ifTrue:[
@@ -421,35 +421,46 @@
 			].
 		    ].
 
-		    makeLowercase := makeUppercase := makeUppercaseFirst := false.
+		    makeLowercase := makeUppercase := makeUppercaseFirst := makeLowercaseFirst := false.
 		    isLowerFirst ifTrue:[
 			makeUppercaseFirst := true.
 		    ] ifFalse:[
-			isAllUpper ifTrue:[
-			    makeLowercase := true.
-			] ifFalse:[
-			    makeUppercase := true.
+			"/ must remember where we come from - otherwise, we end up
+			"/ in upperFirst - lowerFirst cycle.
+			"/ think about a good place to store this state
+			false "(isUpperFirst and:[isAllUpper not])" ifTrue:[
+			    makeLowercaseFirst := true.
+			 ] ifFalse:[
+			    isAllUpper ifTrue:[
+				makeLowercase := true.
+			    ] ifFalse:[
+				makeUppercase := true.
+			    ]
 			]
 		    ].
 		    makeUppercaseFirst ifTrue:[
 			line at:col1 put:(line at:col1) asUppercase.
 		    ] ifFalse:[
-			col1 to:col2 do:[:col |
-			    |ch|
+			makeLowercaseFirst ifTrue:[
+			    line at:col1 put:(line at:col1) asLowercase.
+			] ifFalse:[
+			    col1 to:col2 do:[:col |
+				|ch|
 
-			    ch := line at:col.
-			    ch := makeLowercase
-				    ifTrue:[ ch asLowercase ]
-				    ifFalse:[
-					makeUppercase
-					    ifTrue:[ ch asUppercase ]
-					    ifFalse:[
-						col == col1
-						    ifTrue:[ ch asUppercase ]
-						    ifFalse:[ ch asLowercase ]
-					    ]
-				    ].
-			    line at:col put:ch.
+				ch := line at:col.
+				ch := makeLowercase
+					ifTrue:[ ch asLowercase ]
+					ifFalse:[
+					    makeUppercase
+						ifTrue:[ ch asUppercase ]
+						ifFalse:[
+						    col == col1
+							ifTrue:[ ch asUppercase ]
+							ifFalse:[ ch asLowercase ]
+						]
+					].
+				line at:col put:ch.
+			    ].
 			].
 		    ].
 		    self withoutRedrawAt:lineNr put:line.