aboutsummaryrefslogtreecommitdiff
path: root/Screen.hs
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2013-08-27 15:03:04 -0300
committerRaúl Benencia <rul@kalgan.cc>2013-08-27 15:03:04 -0300
commitfab15274bae93611f85dd4cc221ce07b1661a081 (patch)
tree1023af4c4b664ade52466babadf3dc95864aab1e /Screen.hs
parentf21a1f23ab53ab628ed2677c8d85869fa7e22b45 (diff)
Smoother scrolling in index mode
Diffstat (limited to 'Screen.hs')
-rw-r--r--Screen.hs18
1 files changed, 4 insertions, 14 deletions
diff --git a/Screen.hs b/Screen.hs
index 42f8ac8..189840e 100644
--- a/Screen.hs
+++ b/Screen.hs
@@ -14,7 +14,6 @@ import Control.Monad.Reader
import Control.Monad.State
import Data.List(isPrefixOf)
import System.Exit
-import System.IO(IOMode(..), hGetContents, openFile)
import Text.ParserCombinators.Parsec.Rfc2822(Message(..))
import UI.NCurses
@@ -123,25 +122,16 @@ clearMain rows columns = do
-- | Helper function of drawMode
drawIndexHelper [] = resetCurrentRow
-drawIndexHelper (m:ms) = do
+drawIndexHelper ((path, str):ms) = do
st <- get
(=<<) put $ liftUpdate $ do
- msg <- liftToUpdate $ hGetContents =<< (openFile m ReadMode)
moveCursor (curRowAsInteger st) (colPadAsInteger st)
- let email = parseEmail msg
- let fs = getFields email
- let str = normalizeLen (screenColumns st) . concat $
- [ show $ (currentRow st) + (scrollRowIn . indexState $ st) + 1
- , (ppSep ++) $ ppFlags . getFlags $ m
- , (ppSep ++) $ ppIndexNameAddr . getFrom $ fs
- , (ppSep ++) $ ppIndexSubject . getSubject $ fs
- ]
if (selectedRow st == currentRow st)
then do
setColor $ selectionColorID . colorStyle $ st
drawString str
setColor $ baseColorID . colorStyle $ st
- let indexState' = (indexState st) { selectedEmail = email}
+ let indexState' = (indexState st) { selectedEmailPath = path }
return $ st { indexState = indexState' }
else do
drawString str
@@ -239,5 +229,5 @@ incrementCurrentRow = (=<<) put $ get >>= \st -> return $ st { currentRow = (cur
liftCurses = lift . lift
liftUpdate = lift . lift
-liftToUpdate :: IO a -> Update a
-liftToUpdate io = Update $ lift (liftIO io) \ No newline at end of file
+--liftToUpdate :: IO a -> Update a
+--liftToUpdate io = Update $ lift (liftIO io) \ No newline at end of file
nihil fit ex nihilo