diff options
author | tv <tv@krebsco.de> | 2020-10-06 22:27:24 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-10-06 22:27:50 +0200 |
commit | 704bd63302ba857d6074a23c295bf0fb992da1ee (patch) | |
tree | 1e137c97289f424c18a1b33d602475bc17e35038 /src/Much/Action.hs | |
parent | e43cb8b16b856942e864881a6a9fecab1dabb03c (diff) |
Much.Action += moveCursorTo{First,Last}OnSameLevel
Diffstat (limited to 'src/Much/Action.hs')
-rw-r--r-- | src/Much/Action.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Much/Action.hs b/src/Much/Action.hs index 1e4785a..6613eb1 100644 --- a/src/Much/Action.hs +++ b/src/Much/Action.hs @@ -4,6 +4,7 @@ module Much.Action where import Blessings.String +import Data.Maybe import Scanner import Much.State import Much.TagUtils @@ -107,6 +108,16 @@ moveCursorToThread q@State{..} = moveToParent q >>= moveCursorToThread +moveCursorToFirstOnSameLevel :: Monad m => State -> m State +moveCursorToFirstOnSameLevel q@State{..} = + return q { cursor = fromMaybe cursor . Z.nextTree . Z.first . Z.prevSpace $ cursor } + + +moveCursorToLastOnSameLevel :: Monad m => State -> m State +moveCursorToLastOnSameLevel q@State{..} = + return q { cursor = fromMaybe cursor . Z.prevTree . Z.last . Z.nextSpace $ cursor } + + moveCursorToUnread :: (Num a, Monad m, Eq a) => (Z.TreePos Z.Full TreeView -> Maybe (Z.TreePos Z.Full TreeView)) |