summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-24 20:28:07 +0100
committertv <tv@shackspace.de>2014-12-24 20:28:07 +0100
commit998864578605c2d99299072320208e731ed5099c (patch)
tree52a4148fa65efd271925c1bb057706863692218b
parent4299cd382b10947a8a79e586f95d38823aaa9597 (diff)
flip arguments of focus{Prev,Next}
-rw-r--r--ThreadView.hs12
-rw-r--r--test3.hs12
2 files changed, 12 insertions, 12 deletions
diff --git a/ThreadView.hs b/ThreadView.hs
index e2b1a4b..091c2d0 100644
--- a/ThreadView.hs
+++ b/ThreadView.hs
@@ -86,17 +86,17 @@ describe (TVMessagePart _ p) = "TVMessagePart " <> show (partID p)
-- where
-- msgs = flatten t
-focusPrev :: Maybe ThreadView -> Tree ThreadView -> Maybe ThreadView
-focusPrev Nothing v = lastMay (flatten v)
-focusPrev (Just cur) v = do
+focusPrev :: Tree ThreadView -> Maybe ThreadView -> Maybe ThreadView
+focusPrev v Nothing = lastMay (flatten v)
+focusPrev v (Just cur) = do
i <- elemIndex cur items
maybe (lastMay items) Just $ atMay items (i - 1)
where
items = flatten v
-focusNext :: Maybe ThreadView -> Tree ThreadView -> Maybe ThreadView
-focusNext Nothing v = headMay (flatten v)
-focusNext (Just cur) v = do
+focusNext :: Tree ThreadView -> Maybe ThreadView -> Maybe ThreadView
+focusNext v Nothing = headMay (flatten v)
+focusNext v (Just cur) = do
i <- elemIndex cur items
maybe (headMay items) Just $ atMay items (i + 1)
where
diff --git a/test3.hs b/test3.hs
index 3dfa036..f5b600a 100644
--- a/test3.hs
+++ b/test3.hs
@@ -143,25 +143,25 @@ main =
update vty pic
nextEvent vty >>= \e -> case e of
EvKey KUp [] ->
- --case focusPrev t_cur t of
- --case focusPrev c v of
+ --case focusPrev t t_cur of
+ --case focusPrev v c of
-- Just t_prev ->
-- --rec vty t_prev t
-- rec vty (i + 1) t_prev v
-- Nothing ->
-- --rec vty t_cur t
-- rec vty (i + 1) c v
- rec vty (i + 1) (focusPrev c v) v
+ rec vty (i + 1) (focusPrev v c) v
EvKey KDown [] ->
- --case focusNext t_cur t of
- --case focusNext c v of
+ --case focusNext t t_cur of
+ --case focusNext v c of
-- Just t_next ->
-- --rec vty t_next t
-- rec vty (i + 1) t_next v
-- Nothing ->
-- --rec vty t_cur t
-- rec vty (i + 1) c v
- rec vty (i + 1) (focusNext c v) v
+ rec vty (i + 1) (focusNext v c) v
EvKey KEnter [] ->
case c of
Nothing -> error "no cursor"