summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-10-06 22:27:24 +0200
committertv <tv@krebsco.de>2020-10-06 22:27:50 +0200
commit704bd63302ba857d6074a23c295bf0fb992da1ee (patch)
tree1e137c97289f424c18a1b33d602475bc17e35038 /src
parente43cb8b16b856942e864881a6a9fecab1dabb03c (diff)
Much.Action += moveCursorTo{First,Last}OnSameLevel
Diffstat (limited to 'src')
-rw-r--r--src/Much/Action.hs11
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))