simple-ui 0.1.1 → 0.1.2
raw patch · 4 files changed
+26/−7 lines, 4 filesdep ~lensdep ~stmdep ~template-haskellsetup-changed
Dependency ranges changed: lens, stm, template-haskell
Files
- Setup.hs +0/−2
- simple-ui.cabal +4/−4
- src/Simple/UI/Widgets/TextListView.hs +21/−0
- stack.yaml +1/−1
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
simple-ui.cabal view
@@ -1,5 +1,5 @@ name: simple-ui-version: 0.1.1+version: 0.1.2 cabal-version: >=1.22 build-type: Simple author: Piotr Borek <piotrborek@op.pl>@@ -29,11 +29,11 @@ mtl (>= 2.2 && < 2.3), exceptions (>= 0.8 && < 0.11), vty (>= 5.16 && < 6),- lens (>= 4.15 && < 4.17),+ lens (>= 4.15 && < 4.18), vector (>= 0.11 && < 0.13), data-default-class (>= 0.1 && < 0.2),- template-haskell (>= 2.11 && < 2.14),- stm (>= 2.4 && < 2.5)+ template-haskell (>= 2.11 && < 2.15),+ stm (>= 2.4 && < 2.6) exposed-modules: Simple.UI.All
src/Simple/UI/Widgets/TextListView.hs view
@@ -233,6 +233,12 @@ Vty.KPageDown -> forM_ ([1..height `div` 2] :: [Int]) $ const (goDown textListView) + Vty.KHome ->+ goHome textListView+ + Vty.KEnd ->+ goEnd textListView+ Vty.KEnter -> do pos <- get textListView _textListViewPos when (pos >= 0) $ do@@ -275,3 +281,18 @@ hasItem <- hasNthItem textListView (pos + yOffset + 1) when hasItem $ modify textListView _textListViewYOffset succ++goHome :: TextListView a -> UIApp u ()+goHome textListView = do+ set textListView _textListViewPos 0+ set textListView _textListViewYOffset 0++goEnd :: TextListView a -> UIApp u ()+goEnd textListView = do+ pos <- get textListView _textListViewPos+ yOffset <- get textListView _textListViewYOffset+ goDown textListView+ pos' <- get textListView _textListViewPos+ yOffset' <- get textListView _textListViewYOffset+ when (pos + yOffset /= pos' + yOffset') $+ goEnd textListView
stack.yaml view
@@ -1,4 +1,4 @@-resolver: lts-9.21+resolver: lts-13.18 packages: - '.' flags: {}