keyboard.rc
changeset 548 6daf7f816f04
parent 547 1e6d4bc65192
child 550 1ab596a68079
--- a/keyboard.rc	Tue Aug 19 12:34:42 2003 +0200
+++ b/keyboard.rc	Thu Aug 21 15:04:51 2003 +0200
@@ -286,6 +286,60 @@
 	]
 	'.
 
+"/
+"/ macro to convert selection to lowercaseFirst words
+"/
+macros at:#ConvertSelectionToLowercaseFirst put:'
+	"to-lower selected text"
+
+	|line1 line2|
+
+	line1 := self selectionStartLine.
+	line2 := self selectionEndLine.
+	line1 isNil ifTrue:[
+	    line1 := self perform:#cursorLine ifNotUnderstood:nil.
+	    line1 notNil ifTrue:[
+		line2 := line1
+	    ]
+	].
+	line1 notNil ifTrue:[    
+	    line1 to:line2 do:[:lineNr |
+		|line col1 col2 state|
+
+		line := self listAt:lineNr.
+		line size > 0 ifTrue:[
+		    lineNr == line1 ifTrue:[
+			col1 := selectionStartCol.
+		    ] ifFalse:[
+			col1 := 1.
+		    ].
+		    lineNr == line2 ifTrue:[
+			col2 := selectionEndCol.
+		    ] ifFalse:[
+			col2 := (self listAt:lineNr) size.
+		    ].
+
+		    state := #first.
+		    col1 to:col2 do:[:col |
+			|ch|
+
+			ch := line at:col.
+			ch isSeparator ifFalse:[
+			    state == #first ifTrue:[
+				line at:col put:ch asUppercase.
+				state := #skipRest
+			    ]
+			] ifTrue:[
+			    state := #first
+			]
+		    ].
+		    self withoutRedrawAt:lineNr put:line.
+		    self invalidateLine:lineNr.
+		].
+	    ].
+	]
+	'.
+
 macros at:#ConvertSelectionToUppercase put:'
 	"to-lower selected text"
 
@@ -642,7 +696,8 @@
 map bindValue:#IndentBy1 to:#F12.
 map bindValue:#UndentBy1 to:#F11.
 
-map bindValue:#ConvertSelectionToLowercase to:#F6.
+"/ map bindValue:#ConvertSelectionToLowercase to:#F6.
+map bindValue:#ConvertSelectionToLowercaseFirst to:#F6.
 map bindValue:#ConvertSelectionToUppercase to:#F7.
 
 map bindValue:#CommentSelection to:#F3.