# HG changeset patch # User Claus Gittinger # Date 847794816 -3600 # Node ID a75287739271620704d5452641fb06c9bce5b563 # Parent 5bb93a1651cd6e58ce35e98c83ec8e72e6d1e3f3 care for empty selection in comment/uncomment diff -r 5bb93a1651cd -r a75287739271 CodeView.st --- a/CodeView.st Mon Nov 11 11:28:09 1996 +0100 +++ b/CodeView.st Tue Nov 12 11:33:36 1996 +0100 @@ -153,16 +153,20 @@ |e| - (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ - self commentFrom:selectionStartLine to:selectionEndLine-1 - ] ifFalse:[ - self insert:$" atLine:selectionStartLine col:selectionStartCol. - e := selectionEndCol + 1. - selectionStartLine == selectionEndLine ifTrue:[e := e + 1]. - self insert:$" atLine:selectionEndLine col:e. - self selectFromLine:selectionStartLine col:selectionStartCol - toLine:selectionEndLine col:e. + selectionStartLine notNil ifTrue:[ + (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ + self commentFrom:selectionStartLine to:selectionEndLine-1 + ] ifFalse:[ + self insert:$" atLine:selectionStartLine col:selectionStartCol. + e := selectionEndCol + 1. + selectionStartLine == selectionEndLine ifTrue:[e := e + 1]. + self insert:$" atLine:selectionEndLine col:e. + self selectFromLine:selectionStartLine col:selectionStartCol + toLine:selectionEndLine col:e. + ] ] + + "Modified: 12.11.1996 / 11:32:40 / cg" ! editMenu @@ -239,23 +243,27 @@ |e| - (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ - self uncommentFrom:selectionStartLine to:selectionEndLine-1 - ] ifFalse:[ - ((self characterAtLine:selectionStartLine col:selectionStartCol) == $" - and:[(self characterAtLine:selectionEndLine col:selectionEndCol) == $"]) ifTrue:[ - self deleteCharAtLine:selectionEndLine col:selectionEndCol. - self deleteCharAtLine:selectionStartLine col:selectionStartCol. - e := selectionEndCol - 1. - selectionStartLine == selectionEndLine ifTrue:[e := e - 1]. - self selectFromLine:selectionStartLine col:selectionStartCol - toLine:selectionEndLine col:e. - ] + selectionStartLine notNil ifTrue:[ + (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ + self uncommentFrom:selectionStartLine to:selectionEndLine-1 + ] ifFalse:[ + ((self characterAtLine:selectionStartLine col:selectionStartCol) == $" + and:[(self characterAtLine:selectionEndLine col:selectionEndCol) == $"]) ifTrue:[ + self deleteCharAtLine:selectionEndLine col:selectionEndCol. + self deleteCharAtLine:selectionStartLine col:selectionStartCol. + e := selectionEndCol - 1. + selectionStartLine == selectionEndLine ifTrue:[e := e - 1]. + self selectFromLine:selectionStartLine col:selectionStartCol + toLine:selectionEndLine col:e. + ] + ] ] + + "Modified: 12.11.1996 / 11:32:57 / cg" ! ! !CodeView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.30 1996-04-25 16:44:11 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.31 1996-11-12 10:33:36 cg Exp $' ! !