jtdaugherty/vty-ui — pull request #38 by angerman (2014-05-01 20:44:44+00:00)
Title: Minor List improvements.

This contains two (of possibly more to follow) improvements to the List Widget.

The first is the inclusion of the indexOf function, which when given a `Widget List a b` an element of `a` where `a` belongs to the class `Eq`, returns the index of the list, at which the internal element a with it's accompanying widget is displayed. This allows to lookup the position of an item in the list and select or scroll to that item. Assuming one drives the list primarily by it's internal elements.

The second removes a check of `scrollWindowSize list == 0`. This lead to the strange behavior of
```haskell
lst <- newList black `on` yellow 1
forM_ ["A", "B", "C"] $ x ->
plainText (T.pack x) >>= addToList lst "unused"
lst `setSelected` 1
sel <- getSelected lst
-- At this point `sel` is `Just (0, ("unused", "A"))` and not
-- as expected `Just (1, ("unused", "B"))`
```

Thus the second commit allows to select an item of the list prior to it being displayed.