diff options
author | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 15:03:04 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 15:03:04 -0300 |
commit | fab15274bae93611f85dd4cc221ce07b1661a081 (patch) | |
tree | 1023af4c4b664ade52466babadf3dc95864aab1e /Screen.hs | |
parent | f21a1f23ab53ab628ed2677c8d85869fa7e22b45 (diff) |
Smoother scrolling in index mode
Diffstat (limited to 'Screen.hs')
-rw-r--r-- | Screen.hs | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -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 |