aboutsummaryrefslogtreecommitdiff
path: root/Screen.hs
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2013-08-29 22:37:11 -0300
committerRaúl Benencia <rul@kalgan.cc>2013-08-29 22:37:11 -0300
commite4cc85a6fbf1eb3dcdc8304404183ea8db0a39ff (patch)
tree2eaf6a59ed37bd4281f6149b18629185e6179e64 /Screen.hs
parent1fa4f4dbabe7ced318a8c657f1a3897331d44501 (diff)
Towards email scrolling
Diffstat (limited to 'Screen.hs')
-rw-r--r--Screen.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Screen.hs b/Screen.hs
index 8383fe2..c2da7ac 100644
--- a/Screen.hs
+++ b/Screen.hs
@@ -58,7 +58,7 @@ startCurses = do
return $ st { screenRows = fromIntegral $ rows - 1
, screenColumns = fromIntegral $ cols
, colorStyle = style }
-
+
resetScrollBuffer
screenLoop
@@ -140,8 +140,8 @@ drawEmailHelper = do
let body = getBody $ selectedEmail . indexState $ st
let maxRows = if statusBar st then (scrRowsAsInteger st) - 1 else scrRowsAsInteger st
let emailLines = formatBody body $ (screenColumns st) - 1
- drawBody ((curRowAsInteger st) + 4) (colPadAsInteger st) maxRows emailLines
-
+ liftUpdate $ drawBody ((curRowAsInteger st) + 4) (colPadAsInteger st) maxRows emailLines
+
{- Draw the email headers -}
drawEmailHeader = do
st <- get
@@ -157,13 +157,13 @@ drawEmailHeader = do
moveCursor (row + 2) (colPadAsInteger st)
drawString $ ("Subject: " ++) $ cropWith "Subject: " . ppSubject . getSubject $ fs
setColor $ baseColorID . colorStyle $ st
-
-{- Draw the email body -}
+
+{- Draw the email body -}
drawBody _ _ _ [] = return ()
-drawBody row col maxRows (xs:xss) = liftUpdate $ do
+drawBody row col maxRows (xs:xss) = do
moveCursor row col
drawString xs
- if row < maxRows then drawBody (row + 1) col maxRows xss else return ()
+ when (row < maxRows) $ drawBody (row + 1) col maxRows xss
{- Draw a status line with the current mode and other stuff -}
drawStatus = do
@@ -227,11 +227,11 @@ resetScrollBuffer = do
MaildirMode -> do
let mst = (maildirState st) {
scrollBufferMD = EH.scrollCrop 0 (screenRows st) $ detectedMDs . maildirState $ st }
- put st { maildirState = mst}
+ put st { maildirState = mst}
IndexMode -> do
let ist = (indexState st) {
scrollBufferIn = EH.scrollCrop 0 (screenRows st) $ selectedEmails . indexState $ st }
- put st { indexState = ist }
+ put st { indexState = ist }
-- The type system complains if I want to use the same function for diferents monads
nihil fit ex nihilo