summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-28 03:43:28 +0100
committertv <tv@shackspace.de>2014-12-28 03:43:28 +0100
commit9edccfb36aa2d266d6f8038f6195c78697b3d0be (patch)
tree4049779ae5a57b1e4a626cbfa1136166f4e24c12
parent26855c9b19327d009e6d8ce805b37657ef96403c (diff)
test4: add missing top-level declarations
-rw-r--r--test4.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/test4.hs b/test4.hs
index 3aed503..f493e6a 100644
--- a/test4.hs
+++ b/test4.hs
@@ -168,13 +168,18 @@ keymap _ = Nothing
+topOverrun :: State -> Int
topOverrun State{..} =
max 0 (- (linearPos cursor - yoffset))
+
+botOverrun :: State -> Int
botOverrun State{..} =
max 0 (linearPos cursor - yoffset - (screenHeight - (length headBuffer) - 1))
+
+moveCursorDown :: Monad m => Int -> State -> m State
moveCursorDown n q@State{..} =
let cursor' = findNextN n cursor
q' = q { cursor = cursor' }
@@ -183,6 +188,7 @@ moveCursorDown n q@State{..} =
i -> moveTreeUp i q'
+moveCursorUp :: Monad m => Int -> State -> m State
moveCursorUp n q@State{..} =
let cursor' = findPrevN n cursor
q' = q { cursor = cursor' }
@@ -191,6 +197,7 @@ moveCursorUp n q@State{..} =
i -> moveTreeDown i q'
+moveTreeUp :: Monad m => Int -> State -> m State
moveTreeUp n q@State{..} =
let q' = q { yoffset = min (length treeBuffer - 1) $ max 0 (yoffset + n) }
in case topOverrun q' of
@@ -198,6 +205,7 @@ moveTreeUp n q@State{..} =
i -> moveCursorDown i q'
+moveTreeDown :: Monad m => Int -> State -> m State
moveTreeDown n q@State{..} =
let q' = q { yoffset = min (length treeBuffer - 1) $ max 0 (yoffset - n) }
in case botOverrun q' of
@@ -205,6 +213,8 @@ moveTreeDown n q@State{..} =
i -> moveCursorUp i q'
+
+toggleFold :: State -> IO State
toggleFold q@State{..} = case Z.label cursor of
TVMessage m -> do
toggleTag (T.pack "open") m
@@ -249,6 +259,7 @@ toggleFold q@State{..} = case Z.label cursor of
+replyToAll :: State -> IO State
replyToAll q@State{..} = case getMessage (Z.label cursor) of
Nothing ->
return q { flashMessage = "no message" }
@@ -283,6 +294,7 @@ replyToAll q@State{..} = case getMessage (Z.label cursor) of
return q
+viewSource :: State -> IO State
viewSource q@State{..} = case getMessage (Z.label cursor) of
Nothing ->
return q { flashMessage = "no message" }