diff --git a/src/tt/tui.py b/src/tt/tui.py index 254010e..a06d1a2 100644 --- a/src/tt/tui.py +++ b/src/tt/tui.py @@ -29,6 +29,7 @@ from .utils import ( get_colored_date, ) +DEFAULT_CATEGORY = "main" COLUMNS = ("ID", "Task", "Status", "Type", "Due", "Category") column_to_field = { 0: "ID", @@ -231,11 +232,16 @@ class TT(App): self.refresh_tasks() def action_add_task(self): + # if filtering on type, status, or category + # the new task should use the selected value + category = self.filters.get("category", DEFAULT_CATEGORY) + status = self.filters.get("status", TaskStatus.ZERO.value).split(",")[0] + type_ = self.filters.get("type", "").split(",")[0] new_task = add_task( text="New Task", - type="", - status=TaskStatus.ZERO.value, - category="main", + type=type_, + status=status, + category=category, ) self.refresh_tasks(restore_cursor=False) self.move_cursor_to_task(new_task.id)