diff options
author | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 00:40:46 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2013-08-27 00:40:46 -0300 |
commit | f21a1f23ab53ab628ed2677c8d85869fa7e22b45 (patch) | |
tree | df3fe3aabf833cee019f4406b19f1299e92fa602 | |
parent | 05d6b5f93cd1ed5e9c4f4f9d63cf392ada048afb (diff) |
Improve identing
-rw-r--r-- | State.hs | 58 |
1 files changed, 30 insertions, 28 deletions
@@ -101,20 +101,21 @@ curRowAsInteger st = toInteger $ currentRow st colPadAsInteger st = toInteger $ columnPadding st -incrementSelectedRow st | (selectedRow st) < limit = case (mode st) of - MaildirMode -> - let - sr = (selectedRowMD . maildirState) st - maildirState' = (maildirState st) { selectedRowMD = sr + 1 } - in - st { maildirState = maildirState' } - IndexMode -> - let - sr = (selectedRowIn . indexState) st - indexState' = (indexState st) { selectedRowIn = sr + 1 } - in - st { indexState = indexState' } - _ -> st +incrementSelectedRow st | (selectedRow st) < limit = + case (mode st) of + MaildirMode -> + let + sr = (selectedRowMD . maildirState) st + maildirState' = (maildirState st) { selectedRowMD = sr + 1 } + in + st { maildirState = maildirState' } + IndexMode -> + let + sr = (selectedRowIn . indexState) st + indexState' = (indexState st) { selectedRowIn = sr + 1 } + in + st { indexState = indexState' } + _ -> st | otherwise = st where limit' = case (mode st) of @@ -124,20 +125,21 @@ incrementSelectedRow st | (selectedRow st) < limit = case (mode st) of then fromIntegral $ limit' - 2 else fromIntegral limit' -decrementSelectedRow st | (selectedRow st) > 0 = case (mode st) of - MaildirMode -> - let - sr = (selectedRowMD . maildirState) st - maildirState' = (maildirState st) { selectedRowMD = sr - 1 } - in - st { maildirState = maildirState' } - IndexMode -> - let - sr = (selectedRowIn . indexState) st - indexState' = (indexState st) { selectedRowIn = sr - 1 } - in - st { indexState = indexState' } - _ -> st +decrementSelectedRow st | (selectedRow st) > 0 = + case (mode st) of + MaildirMode -> + let + sr = (selectedRowMD . maildirState) st + maildirState' = (maildirState st) { selectedRowMD = sr - 1 } + in + st { maildirState = maildirState' } + IndexMode -> + let + sr = (selectedRowIn . indexState) st + indexState' = (indexState st) { selectedRowIn = sr - 1 } + in + st { indexState = indexState' } + _ -> st | otherwise = st selectedRow st = case (mode st) of |