--- src/Events/Actions/Normal.hs | 1 + src/Events/Actions/Types.hs | 2 ++ src/Events/State.hs | 7 +++++++ src/IO/Keyboard.hs | 3 ++- src/UI/Draw/Modal/Help.hs | 1 + templates/bindings.ini | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Events/Actions/Normal.hs b/src/Events/Actions/Normal.hs index bf5a040..05aa60e 100644 --- a/src/Events/Actions/Normal.hs +++ b/src/Events/Actions/Normal.hs @@ -33,6 +33,7 @@ events , (A.Left, left) , (A.Right, right) , (A.Bottom, bottom) + , (A.Top, top) -- new tasks , (A.New, (startCreate =<<) . (newItem =<<) . store) , (A.NewAbove, (startCreate =<<) . (above =<<) . store) diff --git a/src/Events/Actions/Types.hs b/src/Events/Actions/Types.hs index 6d3509b..0ce190f 100644 --- a/src/Events/Actions/Types.hs +++ b/src/Events/Actions/Types.hs @@ -17,6 +17,7 @@ data ActionType | Left | Right | Bottom + | Top | New | NewAbove | NewBelow @@ -56,6 +57,7 @@ read "next" = Next read "left" = Left read "right" = Right read "bottom" = Bottom +read "top" = Top read "new" = New read "newAbove" = NewAbove read "newBelow" = NewBelow diff --git a/src/Events/State.hs b/src/Events/State.hs index 5d090e1..c8f1fd3 100644 --- a/src/Events/State.hs +++ b/src/Events/State.hs @@ -24,6 +24,7 @@ module Events.State , above , below , bottom + , top , previous , duplicate , next @@ -206,6 +207,12 @@ bottom = pure . selectLast selectLast :: InternalStateful selectLast state = setIndex state (countCurrent state - 1) +top :: Stateful +top = pure . selectFirst + +selectFirst :: InternalStateful +selectFirst state = setIndex state (0) + removeBlank :: Stateful removeBlank state = do currentTask <- getCurrentTask state diff --git a/src/IO/Keyboard.hs b/src/IO/Keyboard.hs index 2f56c14..7865ab2 100644 --- a/src/IO/Keyboard.hs +++ b/src/IO/Keyboard.hs @@ -50,7 +50,8 @@ defaultBindings = , (BChar 'j', A.Next) , (BChar 'h', A.Left) , (BChar 'l', A.Right) - , (BChar 'g', A.Bottom) + , (BChar 'G', A.Bottom) + , (BChar 'g', A.Top) , (BChar 'a', A.New) , (BChar 'O', A.NewAbove) , (BChar 'o', A.NewBelow) diff --git a/src/UI/Draw/Modal/Help.hs b/src/UI/Draw/Modal/Help.hs index abba7e7..dad6c8c 100644 --- a/src/UI/Draw/Modal/Help.hs +++ b/src/UI/Draw/Modal/Help.hs @@ -24,6 +24,7 @@ descriptions = , ([A.Due], "Show tasks with due dates") , ([A.Previous, A.Next, A.Left, A.Right], "Move down / up / left / right") , ([A.Bottom], "Go to bottom of list") + , ([A.Top], "Go to top of list") , ([A.New], "Add a task") , ([A.NewAbove, A.NewBelow], "Add a task above / below") , ([A.Duplicate], "Duplicate a task") diff --git a/templates/bindings.ini b/templates/bindings.ini index c2ce54b..22b0792 100644 --- a/templates/bindings.ini +++ b/templates/bindings.ini @@ -12,6 +12,7 @@ next = j left = h right = l bottom = G +top = g # new tasks new = a -- 2.24.1