aboutsummaryrefslogtreecommitdiff
path: root/Handlers.hs
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2013-08-29 23:33:37 -0300
committerRaúl Benencia <rul@kalgan.cc>2013-08-29 23:33:37 -0300
commit96be972c18b9ff389cf713d9cd025fb31bea503f (patch)
treef930c7895778019320c7af890e746cd2ffb807f1 /Handlers.hs
parent6532d2b357160fe6a41ac4ec3aeb1283027d116e (diff)
down-scrolling support in Email mode
Diffstat (limited to 'Handlers.hs')
-rw-r--r--Handlers.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Handlers.hs b/Handlers.hs
index e01d51a..0fc1bd7 100644
--- a/Handlers.hs
+++ b/Handlers.hs
@@ -34,8 +34,7 @@ changeMode IndexMode = do
let email = parseEmail msg
let body = getBody $ email
let el = formatBody body $ screenColumns st
- let sbe = scrollCrop 0 (screenRows st) el
- let est = (emailState st) { currentEmail = email, emailLines = el, scrollBufferEm = sbe }
+ let est = (emailState st) { currentEmail = email, emailLines = el, scrollRowEm = 0 }
put $ st { mode = EmailMode, emailState = est }
changeMode MaildirMode = do
@@ -86,6 +85,17 @@ incSelectedRow MaildirMode = do
else -- Move the selected row
put $ incrementSelectedRow st
+incSelectedRow EmailMode = do
+ st <- get
+ let est = emailState st
+ let cur = scrollRowEm est
+ let scrRows = screenRows st
+ let totalRows = length $ emailLines est
+ let est' = est { scrollRowEm = (cur + 1) }
+
+ when ((totalRows - scrRows) > (scrollRowEm est)) $
+ put $ st { emailState = est' }
+
incSelectedRow _ = (=<<) put $ get >>= \st -> return $ incrementSelectedRow st
{- More boilerplate code -}
nihil fit ex nihilo