all repos — todo.txt-go @ afca122bfa3e223153006ae7ee265831fa699607

feat: :sparkles: Add clear priority action
Tim Izzo tim@octree.ch
Mon, 24 Mar 2025 22:04:53 +0100
commit

afca122bfa3e223153006ae7ee265831fa699607

parent

1102e482d1dceefe79abdd9f52155c929327cdef

2 files changed, 19 insertions(+), 11 deletions(-)

jump to
M keymap.gokeymap.go

@@ -3,16 +3,17 @@

import "github.com/charmbracelet/bubbles/key" type keyMap struct { - Up key.Binding - Down key.Binding - Priority key.Binding - Help key.Binding - SaveQuit key.Binding - Quit key.Binding - Check key.Binding - Clean key.Binding - Add key.Binding - Sort key.Binding + Up key.Binding + Down key.Binding + Priority key.Binding + ClearPriority key.Binding + Help key.Binding + SaveQuit key.Binding + Quit key.Binding + Check key.Binding + Clean key.Binding + Add key.Binding + Sort key.Binding } // ShortHelp returns keybindings to be shown in the mini help view. It's part

@@ -26,7 +27,7 @@ // key.Map interface.

func (k keyMap) FullHelp() [][]key.Binding { return [][]key.Binding{ {k.Check, k.Priority, k.Up}, - {k.Add, k.Clean, k.Down}, + {k.Add, k.ClearPriority, k.Clean, k.Down}, {k.Sort, k.SaveQuit, k.Quit}, } }

@@ -43,6 +44,10 @@ ),

Priority: key.NewBinding( key.WithKeys("a", "b", "c", "d"), key.WithHelp("a|b|c", "Set priority"), + ), + ClearPriority: key.NewBinding( + key.WithKeys("z"), + key.WithHelp("z", "Clear priority"), ), Add: key.NewBinding( key.WithKeys("A", "+"),
M main.gomain.go

@@ -113,6 +113,9 @@ // Tasks management

case key.Matches(msg, m.keys.Priority): m.tasks[m.cursor].Priority = strings.ToUpper(msg.String()) + case key.Matches(msg, m.keys.ClearPriority): + m.tasks[m.cursor].Priority = "" + case key.Matches(msg, m.keys.Check): _, ok := m.selected[m.cursor]