From 4c620a9c3cec19279402146570af50021bc10df0 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 1 Jun 2018 23:01:20 -0700 Subject: [PATCH] Fix #101. Thanks to @stegmanh --- todo/list.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/todo/list.go b/todo/list.go index 9d93beb6..6ad3f1ec 100644 --- a/todo/list.go +++ b/todo/list.go @@ -33,6 +33,10 @@ func (list *List) CheckedItems() []*Item { func (list *List) Delete() { list.Items = append(list.Items[:list.selected], list.Items[list.selected+1:]...) + + if list.selected >= len(list.Items) { + list.selected-- + } } func (list *List) Demote() {