Fix pickers; Add new select option
This commit is contained in:
@ -382,13 +382,13 @@ type taskEdit struct {
|
||||
fields []huh.Field
|
||||
cursor int
|
||||
|
||||
newProjectName *string
|
||||
newAnnotation *string
|
||||
udaValues map[string]*string
|
||||
// newProjectName *string
|
||||
newAnnotation *string
|
||||
udaValues map[string]*string
|
||||
}
|
||||
|
||||
func NewTaskEdit(com *common.Common, task *taskwarrior.Task) *taskEdit {
|
||||
newProject := ""
|
||||
// newProject := ""
|
||||
projectOptions := append([]string{"(none)"}, com.TW.GetProjects()...)
|
||||
if task.Project == "" {
|
||||
task.Project = "(none)"
|
||||
@ -410,19 +410,19 @@ func NewTaskEdit(com *common.Common, task *taskwarrior.Task) *taskEdit {
|
||||
Prompt(": ").
|
||||
WithTheme(com.Styles.Form),
|
||||
|
||||
huh.NewSelect[string]().
|
||||
Options(huh.NewOptions(projectOptions...)...).
|
||||
input.NewSelect(com).
|
||||
Options(true, input.NewOptions(projectOptions...)...).
|
||||
Title("Project").
|
||||
Value(&task.Project).
|
||||
WithKeyMap(defaultKeymap).
|
||||
WithTheme(com.Styles.Form),
|
||||
|
||||
huh.NewInput().
|
||||
Title("New Project").
|
||||
Value(&newProject).
|
||||
Inline(true).
|
||||
Prompt(": ").
|
||||
WithTheme(com.Styles.Form),
|
||||
// huh.NewInput().
|
||||
// Title("New Project").
|
||||
// Value(&newProject).
|
||||
// Inline(true).
|
||||
// Prompt(": ").
|
||||
// WithTheme(com.Styles.Form),
|
||||
}
|
||||
|
||||
udaValues := make(map[string]*string)
|
||||
@ -513,8 +513,8 @@ func NewTaskEdit(com *common.Common, task *taskwarrior.Task) *taskEdit {
|
||||
|
||||
udaValues: udaValues,
|
||||
|
||||
newProjectName: &newProject,
|
||||
newAnnotation: &newAnnotation,
|
||||
// newProjectName: &newProject,
|
||||
newAnnotation: &newAnnotation,
|
||||
}
|
||||
|
||||
t.fields[0].Focus()
|
||||
@ -997,9 +997,9 @@ func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
}
|
||||
}
|
||||
|
||||
if *(p.areas[0].(*taskEdit).newProjectName) != "" {
|
||||
p.task.Project = *p.areas[0].(*taskEdit).newProjectName
|
||||
}
|
||||
// if *(p.areas[0].(*taskEdit).newProjectName) != "" {
|
||||
// p.task.Project = *p.areas[0].(*taskEdit).newProjectName
|
||||
// }
|
||||
|
||||
if *(p.areas[1].(*tagEdit).newTagsValue) != "" {
|
||||
newTags := strings.Split(*p.areas[1].(*tagEdit).newTagsValue, " ")
|
||||
|
||||
Reference in New Issue
Block a user