diff --git a/twander.py b/twander.py index c1f9276..25aec4e 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.20 2002/12/17 17:19:52 tundra Exp $" +RCSID = "$Id: twander.py,v 2.21 2002/12/18 19:39:41 tundra Exp $" VERSION = RCSID.split()[2] @@ -1132,7 +1132,13 @@ ##### def KeySelNext(event): - next = UI.DirList.index(ACTIVE) + 1 + + next = UI.DirList.index(ACTIVE) + + # Don't increment if at end of list + if (next < UI.DirList.size() - 1): + next += 1 + SetSelection((str(next),), next) # End of 'KeySelNext()' @@ -1153,7 +1159,12 @@ ##### def KeySelPrev(event): - prev = UI.DirList.index(ACTIVE) - 1 + prev = UI.DirList.index(ACTIVE) + + # Only decrement if > 0 + if prev: + prev -= 1 + SetSelection((str(prev),), prev) # End of 'KeySelPrev()' @@ -1165,8 +1176,8 @@ def KeySelEnd(event): - # Get current number of items in listbox - sz = UI.DirList.size() + # Get index of last item in listbox + sz = UI.DirList.size() - 1 # And setup to last item accordingly SetSelection((str(sz),), sz)