From b8fe625405784fe79d8ca44cabf3ea442c4dca72 Mon Sep 17 00:00:00 2001 From: kageru Date: Wed, 27 May 2020 11:42:17 +0200 Subject: [PATCH] Move to next todo item after marking one as done --- src/todolist.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/todolist.rs b/src/todolist.rs index 8cd6c21..16c7c6b 100644 --- a/src/todolist.rs +++ b/src/todolist.rs @@ -50,6 +50,7 @@ impl TodoList { pub fn toggle_current(&mut self) { self.todos[self.selected].done = !self.todos[self.selected].done; + self.selected = (self.selected + 1).min(self.todos.len() - 1) } fn current(&self) -> &Todo {