--- a/keyboardMacros.rc Sun Oct 25 02:44:11 2009 +0200
+++ b/keyboardMacros.rc Thu Oct 29 15:04:31 2009 +0100
@@ -372,7 +372,7 @@
'.
macros at:#ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst put:'
- "to-lower selected text"
+ "toLower/toUppercaseFirst/toUpper selected text"
|line1 line2|
@@ -386,7 +386,7 @@
].
line1 notNil ifTrue:[
line1 to:line2 do:[:lineNr |
- |line col1 col2 isAllLower isAllUpper isUpperFirst
+ |line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst
makeLowercase makeUppercase makeUppercaseFirst|
line := (self listAt:lineNr) copy.
@@ -401,52 +401,56 @@
] ifFalse:[
col2 := (self listAt:lineNr) size.
].
- isAllLower := isAllUpper := isUpperFirst := true.
+ isAllLower := isAllUpper := isUpperFirst := isLowerFirst := true.
col1 to:col2 do:[:col |
|ch|
ch := line at:col.
ch isUppercase ifTrue:[
isAllLower := false.
- col ~~ col1 ifTrue:[
- isUpperFirst := false.
+ col == col1 ifTrue:[
+ isLowerFirst := false.
].
] ifFalse:[
ch isLowercase ifTrue:[
- isUpperFirst := false.
isAllUpper := false.
col == col1 ifTrue:[
- "/ isUpperFirst := false.
+ isUpperFirst := false.
].
]
].
].
+
makeLowercase := makeUppercase := makeUppercaseFirst := false.
- isAllLower ifTrue:[
- makeUppercase := true.
+ isLowerFirst ifTrue:[
+ makeUppercaseFirst := true.
] ifFalse:[
isAllUpper ifTrue:[
- makeUppercaseFirst := true.
+ makeLowercase := true.
] ifFalse:[
- makeLowercase := true.
+ makeUppercase := true.
]
].
- col1 to:col2 do:[:col |
- |ch|
+ makeUppercaseFirst ifTrue:[
+ line at:col1 put:(line at:col1) asUppercase.
+ ] 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.
self invalidateLine:lineNr.