From 04dbb364ccd9b3ddf0536481ebc4ddddefabbbdf Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 23 Oct 2018 15:36:21 +0000 Subject: [PATCH] Fix cursor movement when deleting tasks --- src/TaskMachine/UI/TaskList.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TaskMachine/UI/TaskList.hs b/src/TaskMachine/UI/TaskList.hs index 3164f36..7966082 100644 --- a/src/TaskMachine/UI/TaskList.hs +++ b/src/TaskMachine/UI/TaskList.hs @@ -85,7 +85,9 @@ deleteTask :: TaskList n -> TaskList n deleteTask tl@(TaskList list) = case B.listSelected list of Nothing -> tl - Just index -> TaskList $ B.listMoveBy 1 $ B.listRemove index list + Just index + | index == 0 -> TaskList $ B.listRemove index list + | otherwise -> TaskList $ B.listMoveBy 1 $ B.listRemove index list {- helper functions -}