diff options
author | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 23:34:10 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 23:34:10 -0300 |
commit | 77112dd4cd7657ebf16734d117d42283ee34c742 (patch) | |
tree | a180f9d9635ced5071d5e32557dfb13b5ad49541 /State.hs | |
parent | 496546229d1b5060c88266210f303a48280c885c (diff) |
Scrolling working in Maildir mode
Diffstat (limited to 'State.hs')
-rw-r--r-- | State.hs | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -34,6 +34,9 @@ data MaildirState = MaildirState { selectedRowMD :: Int , selectedMD :: String , detectedMDs :: [(FilePath, String)] + , scrollRowMD :: Int + , scrollBufferMD :: [(FilePath, String)] + } data IndexState = IndexState { @@ -72,9 +75,11 @@ initialState = LazymailState { } initialMaildirState = MaildirState { - selectedRowMD = 0 - , selectedMD = "" - , detectedMDs = [] + selectedRowMD = 0 + , selectedMD = "" + , detectedMDs = [] + , scrollRowMD = 0 + , scrollBufferMD = [] } initialIndexState = IndexState { @@ -121,11 +126,11 @@ incrementSelectedRow st | (selectedRow st) < limit = | otherwise = st where scrRows = screenRows st + curInLen = length $ selectedEmails . indexState $ st + curMDLen = length $ detectedMDs . maildirState $ st limit' = case (mode st) of - MaildirMode -> (length $ detectedMDs . maildirState $ st ) - 1 - IndexMode -> if (currentInLen . indexState $ st) < scrRows - then (currentInLen . indexState $ st) - 1 - else scrRows + MaildirMode -> if curMDLen < scrRows then curMDLen - 1 else scrRows + IndexMode -> if curInLen < scrRows then curInLen - 1 else scrRows limit = if (statusBar st) && (limit' == scrRows) then fromIntegral $ limit' - 2 else fromIntegral limit' |