|
@@ -48,9 +48,6 @@ var (
|
|
|
Margin(1).
|
|
Margin(1).
|
|
|
BorderStyle(lipgloss.NormalBorder())
|
|
BorderStyle(lipgloss.NormalBorder())
|
|
|
|
|
|
|
|
- indexStyle = lipgloss.NewStyle().
|
|
|
|
|
- Italic(true)
|
|
|
|
|
-
|
|
|
|
|
pointerStyle = lipgloss.NewStyle().
|
|
pointerStyle = lipgloss.NewStyle().
|
|
|
Faint(true)
|
|
Faint(true)
|
|
|
|
|
|
|
@@ -641,6 +638,8 @@ func (i Issue) update(msg tea.Msg) (widget, tea.Cmd) {
|
|
|
cmds = append(cmds, i.edit)
|
|
cmds = append(cmds, i.edit)
|
|
|
case "esc":
|
|
case "esc":
|
|
|
cmds = append(cmds, i.back)
|
|
cmds = append(cmds, i.back)
|
|
|
|
|
+ case "d":
|
|
|
|
|
+ return i, func() tea.Msg { return deletePath(i.Path) }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return i, tea.Batch(cmds...)
|
|
return i, tea.Batch(cmds...)
|
|
@@ -707,9 +706,9 @@ func (i Issue) keyhelp() string {
|
|
|
var escStr string
|
|
var escStr string
|
|
|
remainder, _ := filepath.Split(i.Path)
|
|
remainder, _ := filepath.Split(i.Path)
|
|
|
if IsIssueCollection(remainder) {
|
|
if IsIssueCollection(remainder) {
|
|
|
- escStr = "\t\tesc: back"
|
|
|
|
|
|
|
+ escStr = "esc: back\t\t"
|
|
|
}
|
|
}
|
|
|
- output = output + fmt.Sprintf("e: edit%s\t\tctrl+c: quit", escStr)
|
|
|
|
|
|
|
+ output = output + fmt.Sprintf("e: edit\t\td: delete\n\n%sctrl+c: quit", escStr)
|
|
|
return output
|
|
return output
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -839,13 +838,14 @@ func (w setTitle) render() tea.Msg {
|
|
|
|
|
|
|
|
func (w setTitle) keyhelp() string { return "enter: submit" }
|
|
func (w setTitle) keyhelp() string { return "enter: submit" }
|
|
|
|
|
|
|
|
|
|
+// -------- confirmDelete widget definitions ----------------------------------
|
|
|
|
|
+// ----------------------------------------------------------------------------
|
|
|
|
|
+
|
|
|
type confirmDelete struct {
|
|
type confirmDelete struct {
|
|
|
Path string
|
|
Path string
|
|
|
input textinput.Model
|
|
input textinput.Model
|
|
|
prompt string
|
|
prompt string
|
|
|
validateString string
|
|
validateString string
|
|
|
- err string
|
|
|
|
|
- success bool
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (w confirmDelete) update(msg tea.Msg) (widget, tea.Cmd) {
|
|
func (w confirmDelete) update(msg tea.Msg) (widget, tea.Cmd) {
|
|
@@ -858,11 +858,7 @@ func (w confirmDelete) update(msg tea.Msg) (widget, tea.Cmd) {
|
|
|
case tea.KeyMsg:
|
|
case tea.KeyMsg:
|
|
|
switch msg.String() {
|
|
switch msg.String() {
|
|
|
case "enter":
|
|
case "enter":
|
|
|
- if w.success {
|
|
|
|
|
- cmds = append(cmds, w.back)
|
|
|
|
|
- } else {
|
|
|
|
|
- cmds = append(cmds, w.validate)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ cmds = append(cmds, w.validate)
|
|
|
case "esc":
|
|
case "esc":
|
|
|
cmds = append(cmds, w.back)
|
|
cmds = append(cmds, w.back)
|
|
|
}
|
|
}
|
|
@@ -875,34 +871,18 @@ func (w confirmDelete) update(msg tea.Msg) (widget, tea.Cmd) {
|
|
|
cmds = append(cmds, w.back)
|
|
cmds = append(cmds, w.back)
|
|
|
}
|
|
}
|
|
|
case deleteResult:
|
|
case deleteResult:
|
|
|
- if len(msg) > 0 {
|
|
|
|
|
- w.success = true
|
|
|
|
|
- cmds = append(cmds, w.render)
|
|
|
|
|
- } else {
|
|
|
|
|
- w.err = string(msg)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ cmds = append(cmds, w.back)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return w, tea.Batch(cmds...)
|
|
return w, tea.Batch(cmds...)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (w confirmDelete) render() tea.Msg {
|
|
func (w confirmDelete) render() tea.Msg {
|
|
|
- if len(w.err) == 0 {
|
|
|
|
|
- if w.success {
|
|
|
|
|
- return fmt.Sprintf("Successfully deleted %s", w.Path)
|
|
|
|
|
- }
|
|
|
|
|
- prompt := fmt.Sprintf("%s (%s)...\n", w.prompt, w.Path)
|
|
|
|
|
- return fmt.Sprintf("%s%s", prompt, w.input.View())
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // wrap in string so its caught by the content update signal
|
|
|
|
|
- return w.err
|
|
|
|
|
|
|
+ prompt := fmt.Sprintf("%s (%s)...\n", w.prompt, w.Path)
|
|
|
|
|
+ return fmt.Sprintf("%s%s", prompt, w.input.View())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (w confirmDelete) keyhelp() string {
|
|
func (w confirmDelete) keyhelp() string {
|
|
|
- if w.success {
|
|
|
|
|
- return "enter: continue\t\tesc: continue"
|
|
|
|
|
- }
|
|
|
|
|
return "enter: submit\t\tesc: cancel"
|
|
return "enter: submit\t\tesc: cancel"
|
|
|
}
|
|
}
|
|
|
|
|
|