feat: :sparkles: Circular navigation on tasks list
Tim Izzo tim@octree.ch
Sat, 12 Apr 2025 18:02:15 +0200
M
README.md
→
README.md
@@ -6,7 +6,8 @@ - [x] Use _todo.txt_ file targeted by todo-txt.sh config
- [x] Implement archive mecanism - [x] Allow task edition - [x] Allow to remove priority on task -- [ ] Circular navigation on tasks +- [x] Circular navigation on tasks +- [ ] Provide config file with argument ## Ressources
M
main.go
→
main.go
@@ -105,14 +105,14 @@
switch { // Navigation case key.Matches(msg, m.keys.Up): - if m.cursor > 0 { - m.cursor-- + newCursor := (m.cursor - 1) % len(m.tasks) + if newCursor < 0 { + newCursor += len(m.tasks) } + m.cursor = newCursor case key.Matches(msg, m.keys.Down): - if m.cursor < len(m.tasks)-1 { - m.cursor++ - } + m.cursor = (m.cursor + 1) % len(m.tasks) // Tasks management case key.Matches(msg, m.keys.Priority):