From 4010acf611b862be18e4a5fc8964f38c7767e5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Fri, 30 Aug 2013 09:49:01 -0300 Subject: Removed the workaround, as Rfc2822 is now fixed --- Email.hs | 20 ++------------------ Handlers.hs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Email.hs b/Email.hs index 2281703..4601aa5 100644 --- a/Email.hs +++ b/Email.hs @@ -18,7 +18,7 @@ data Email = Email { emailPath :: String } parseEmail :: String -> Message -parseEmail msg = unwrapEmail $ parse message "" $ fixEol $ uglyWorkaround msg +parseEmail msg = unwrapEmail $ parse message "" $ fixEol msg unwrapEmail (Right email) = email getFields (Message fs _) = fs @@ -72,20 +72,4 @@ fixEol [] = [] -- emailDescription = emailDescriptionWithPP defaultDescriptionPP --- emailDescriptionWithPP pp - -{- This is an ugly, Ugly, UGLY workaround for the encoding problems that I - - have with Rfc2822 module. I've reported the bug. I hope it get fixed any time soon so - - I can kill this function with fire -} - -uglyWorkaround :: String -> String -uglyWorkaround = map replace where - replace c = - case c of - 'á' -> 'a' - 'é' -> 'e' - 'í' -> 'i' - 'ó' -> 'o' - 'ú' -> 'u' - 'ñ' -> 'n' - _ -> c +-- emailDescriptionWithPP pp \ No newline at end of file diff --git a/Handlers.hs b/Handlers.hs index 0fc1bd7..72f09dc 100644 --- a/Handlers.hs +++ b/Handlers.hs @@ -129,6 +129,17 @@ decSelectedRow MaildirMode = do else put $ decrementSelectedRow st +decSelectedRow 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 + cur)) > 0) $ + put $ st { emailState = est' } + decSelectedRow _ = (=<<) put $ get >>= \st -> return $ decrementSelectedRow st {- Given a list, it returns the elements that will be in the next screen refresh @@ -158,3 +169,6 @@ formatMaildirModeRows st = mapM formatRow where pad = " " numPads = (length $ filter (== '/') str) + (length $ filter (`elem` imapSep) str) imapSep = ['.'] -- IMAP usually separates its directories with dots + +-- TODO: Improve this rancidness +mailHeaderLength = 4 \ No newline at end of file -- cgit v1.2.3