checkin from browser
authorClaus Gittinger <cg@exept.de>
Wed, 23 Jun 1999 14:32:51 +0200
changeset 1926 de514188eaf2
parent 1925 e73fe37177a0
child 1927 d5e14e7bce6f
checkin from browser
TextView.st
--- a/TextView.st	Sat Jun 19 00:46:11 1999 +0200
+++ b/TextView.st	Wed Jun 23 14:32:51 1999 +0200
@@ -1294,50 +1294,46 @@
 
 gotoLine
     "show a box to enter lineNumber for positioning;
-     The entered number may be prefixed by a + or -; in this case,
-     the linenumber is taken relative to the current position."
-
-    |l lineNumberBox input lineToGo fwd bwd|
+     The entered number may be prefixed by a + or -; 
+     in this case, the linenumber is taken relative to the current position."
+
+    |l lineNumberBox input lineToGo relative|
 
     lineNumberBox :=
-	EnterBox
-	   title:(resources string:'line number:')
-	   okText:(resources string:'goto')
-	   abortText:(resources string:'cancel')
-	   action:[:l | input := l].
+        EnterBox
+           title:(resources string:'line number (or +/- relativeNr):')
+           okText:(resources string:'goto')
+           abortText:(resources string:'cancel')
+           action:[:l | input := l].
 
     l := self defaultForGotoLine.
     l notNil ifTrue:[
-	l := l printString
+        l := l printString
     ].
     lineNumberBox initialText:l .
     lineNumberBox showAtPointer.
 
     input size > 0 ifTrue:[
-	input := input withoutSpaces.
-	input size > 0 ifTrue:[
-	    fwd := bwd := false.
-	    (input startsWith:$+) ifTrue:[
-		input := input copyFrom:2.
-		fwd := true.
-	    ] ifFalse:[
-		(input startsWith:$-) ifTrue:[
-		    input := input copyFrom:2.
-		    bwd := true.
-		].
-	    ].
-	    lineToGo := Integer readFromString:input onError:nil.
-	    lineToGo notNil ifTrue:[
-		fwd ifTrue:[
-		    lineToGo := self currentLine + lineToGo
-		] ifFalse:[
-		    bwd ifTrue:[
-			lineToGo := self currentLine - lineToGo
-		    ]
-		].
-		self gotoLine:lineToGo
-	    ]
-	]
+        input := input withoutSpaces.
+        input size > 0 ifTrue:[
+            (input startsWith:$+) ifTrue:[
+                relative := 1.
+            ] ifFalse:[
+                (input startsWith:$-) ifTrue:[
+                    relative := -1.
+                ].
+            ].
+            relative notNil ifTrue:[
+                input := input copyFrom:2.
+            ].
+            lineToGo := Integer readFromString:input onError:nil.
+            lineToGo notNil ifTrue:[
+                relative notNil ifTrue:[
+                    lineToGo := self currentLine + (lineToGo * relative)
+                ].
+                self gotoLine:lineToGo
+            ]
+        ]
     ].
 
     "Modified: / 17.5.1998 / 20:07:59 / cg"
@@ -2959,5 +2955,5 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.137 1999-06-16 20:03:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.138 1999-06-23 12:32:51 cg Exp $'
 ! !