TextView.st
changeset 6140 e15bda508e0b
parent 6135 5d74fd984cde
child 6146 3cf6c9894f53
--- a/TextView.st	Thu Mar 30 22:26:44 2017 +0200
+++ b/TextView.st	Fri Mar 31 15:43:02 2017 +0200
@@ -1940,9 +1940,9 @@
 
      (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
     "
-    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
+    (key notEmptyOrNil and:[(key at:1) asLowercase == $f]) ifTrue:[
         (('[fF][0-9]' match:key)
-        or:['[fF][0-9][0-9]' match:key]) ifTrue:[
+         or:['[fF][0-9][0-9]' match:key]) ifTrue:[
             self sensor shiftDown ifTrue:[
                 UserPreferences current functionKeySequences
                     at:key put:(self selection)
@@ -1953,8 +1953,8 @@
 
     super keyPress:key x:x y:y
 
-    "Modified: / 18-04-1997 / 12:12:27 / stefan"
     "Modified: / 10-03-2012 / 09:40:01 / cg"
+    "Modified (format): / 30-03-2017 / 22:35:58 / stefan"
 !
 
 mapped
@@ -2254,47 +2254,45 @@
      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|
+    |l lineNumberBox input lineToGo relative peekc|
 
     lineNumberBox :=
         EnterBox
            title:(resources string:'Line number (or +/- relativeNr):')
            okText:(resources string:'Goto')
            abortText:(resources string:'Cancel')
-           action:[:l | input := l].
+           action:[:l | input := l readStream].
 
     l := self defaultForGotoLine.
-    l notNil ifTrue:[
-        l := l printString
-    ].
-    lineNumberBox initialText:l .
+    lineNumberBox initialText:(l ifNotNil:[l printString]).
     lineNumberBox label:(resources string:'Goto Line').
     lineNumberBox showAtPointer.
 
-    input size > 0 ifTrue:[
-        input := input withoutSpaces.
-        input size > 0 ifTrue:[
-            (input startsWith:$+) ifTrue:[
-                relative := 1.
-            ] ifFalse:[
-                (input startsWith:$-) ifTrue:[
-                    relative := -1.
-                ].
+    input isNil ifTrue:[
+        ^ self.
+    ].
+
+    peekc := input skipSpaces.
+    peekc notNil ifTrue:[
+        (peekc == $+) ifTrue:[
+            relative := 1.
+        ] ifFalse:[
+            (peekc == $-) 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
-            ]
-        ]
+        ].
+        relative notNil ifTrue:[
+            input next.
+        ].
+        lineToGo := Integer readFrom:input onError:[^ self].
+        relative notNil ifTrue:[
+            lineToGo := self currentLine + (lineToGo * relative)
+        ].
+        self gotoLine:lineToGo.
     ].
 
-    "Modified: / 17.5.1998 / 20:07:59 / cg"
+    "Modified: / 17-05-1998 / 20:07:59 / cg"
+    "Modified: / 30-03-2017 / 23:05:07 / stefan"
 !
 
 openSaveDialog