From 704bd63302ba857d6074a23c295bf0fb992da1ee Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Oct 2020 22:27:24 +0200 Subject: Much.Action += moveCursorTo{First,Last}OnSameLevel --- src/Much/Action.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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)) -- cgit v1.2.3