summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/ui/keyhandlers.go34
-rw-r--r--internal/ui/table.go1
-rwxr-xr-xtasksamuraibin6081536 -> 6082776 bytes
3 files changed, 35 insertions, 0 deletions
diff --git a/internal/ui/keyhandlers.go b/internal/ui/keyhandlers.go
index 204d08f..71a0ddc 100644
--- a/internal/ui/keyhandlers.go
+++ b/internal/ui/keyhandlers.go
@@ -87,6 +87,8 @@ func (m *Model) handleNormalMode(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
return m.handleEditTags()
case "J":
return m.handleEditProject()
+ case "T":
+ return m.handleTagToProject()
case "c":
return m.handleRandomTheme()
case "C":
@@ -411,6 +413,38 @@ func (m *Model) handleEditProject() (tea.Model, tea.Cmd) {
return m, nil
}
+func (m *Model) handleTagToProject() (tea.Model, tea.Cmd) {
+ id, err := m.getSelectedTaskID()
+ if err != nil {
+ return m, nil
+ }
+
+ // Get the task at cursor
+ currentTask := m.getTaskAtCursor()
+ if currentTask == nil || len(currentTask.Tags) == 0 {
+ // No tags to convert
+ return m, nil
+ }
+
+ // Get the first tag
+ firstTag := currentTask.Tags[0]
+
+ // Set the tag as project
+ if err := task.SetProject(id, firstTag); err != nil {
+ m.showError(err)
+ return m, nil
+ }
+
+ // Remove the tag from the task
+ if err := task.RemoveTags(id, []string{firstTag}); err != nil {
+ m.showError(err)
+ return m, nil
+ }
+
+ m.reload()
+ return m, m.startBlink(id, false)
+}
+
func (m *Model) handleRandomTheme() (tea.Model, tea.Cmd) {
m.theme = RandomTheme()
m.applyTheme()
diff --git a/internal/ui/table.go b/internal/ui/table.go
index 9def986..8366b57 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -707,6 +707,7 @@ func (m Model) buildHelpContent() string {
m.formatHelpLine("R", "edit recurrence", keyStyle, descStyle),
m.formatHelpLine("t", "edit tags", keyStyle, descStyle),
m.formatHelpLine("J", "edit project", keyStyle, descStyle),
+ m.formatHelpLine("T", "convert first tag to project", keyStyle, descStyle),
m.formatHelpLine("a, A", "add/replace annotations", keyStyle, descStyle),
m.formatHelpLine("o", "open URL from description", keyStyle, descStyle),
"")
diff --git a/tasksamurai b/tasksamurai
index 8faaf07..9b3623a 100755
--- a/tasksamurai
+++ b/tasksamurai
Binary files differ