SelectionInListModelView.st
changeset 1772 709e1ad163c0
parent 1768 04b330a75f75
child 1818 fe99c5c721e9
--- a/SelectionInListModelView.st	Mon Jun 19 17:04:09 2000 +0200
+++ b/SelectionInListModelView.st	Wed Jun 28 10:45:45 2000 +0200
@@ -1005,19 +1005,15 @@
         char  := aCharacter asUppercase.
 
         start to:stop by:aStep do:[:anIndex|
-            lbl := self characterSearchItemStringAt:anIndex.
-"/
-"/            item := list at:anIndex ifAbsent:nil.
-"/            item isNil ifTrue:[^ 0].    "/ list changed
-"/
-"/            lbl := item perform:#string ifNotUnderstood:nil.
-"/
-            lbl notNil ifTrue:[
-                cmp := lbl string at:1 ifAbsent:nil.
+            (self canSelectIndex:anIndex) ifTrue:[
+                lbl := self characterSearchItemStringAt:anIndex.
+                lbl notNil ifTrue:[
+                    cmp := lbl string at:1 ifAbsent:nil.
 
-                cmp notNil ifTrue:[
-                    (char == cmp or:[char == cmp asUppercase]) ifTrue:[
-                        ^ anIndex
+                    cmp notNil ifTrue:[
+                        (char == cmp or:[char == cmp asUppercase]) ifTrue:[
+                            ^ anIndex
+                        ]
                     ]
                 ]
             ]
@@ -1067,9 +1063,21 @@
 
     aKey == #CursorUp ifTrue:[
         lineNr == 0 ifTrue:[lineNr := size + 1].
-        (n := lineNr - n) <= 0 ifTrue:[n := size + n]
+        (n := lineNr - n) <= 0 ifTrue:[n := size + n].
+        lineNr > size ifTrue:[lineNr := size].
+
+        [self canSelectIndex:n] whileFalse:[
+            (n := n - 1) == 0 ifTrue:[n := size].
+            n == lineNr ifTrue:[^ self]
+        ].
     ] ifFalse:[
-        (n := lineNr + n) > size ifTrue:[n := n - size]
+        (n := lineNr + n) > size ifTrue:[n := n - size].
+        lineNr == 0 ifTrue:[lineNr := 1].
+
+        [self canSelectIndex:n] whileFalse:[
+            (n := n + 1) > size ifTrue:[n := 1].
+            n == lineNr ifTrue:[^ self]
+        ].
     ].
     self selection:n
 ! !
@@ -1590,5 +1598,5 @@
 !SelectionInListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.38 2000-05-08 09:27:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.39 2000-06-28 08:45:45 tm Exp $'
 ! !