summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 10:23:03 +0300
committerGitHub <noreply@github.com>2025-06-20 10:23:03 +0300
commitafad8eec02ca5f0dfd37917c1d4f07399d773604 (patch)
tree9a8b4ef2e90bbdaee531de5bf5fdac5fcb675cd4
parent81e8a4dcbf06c02c8b9df5be7a35a1da632048b0 (diff)
parent18c24407c3dd8a88fe54d06899deb2a5c3b2178d (diff)
Merge pull request #19 from snonux/codex/fix-e-and-s-hotkey-issues
Fix hotkeys for editing and start/stop toggle
-rw-r--r--internal/ui/table.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index 73a53dd..1136428 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -128,7 +128,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
return m, tea.Quit
- case "E":
+ case "e", "E":
if row := m.tbl.SelectedRow(); row != nil {
if id, err := strconv.Atoi(row[0]); err == nil {
return m, editCmd(id)
@@ -137,14 +137,18 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "s":
if row := m.tbl.SelectedRow(); row != nil {
if id, err := strconv.Atoi(row[0]); err == nil {
- idx := m.tbl.Cursor()
- if idx >= 0 && idx < len(m.tasks) {
- if m.tasks[idx].Start == "" {
- task.Start(id)
- } else {
- task.Stop(id)
+ started := false
+ for _, tsk := range m.tasks {
+ if tsk.ID == id {
+ started = tsk.Start != ""
+ break
}
}
+ if started {
+ task.Stop(id)
+ } else {
+ task.Start(id)
+ }
m.reload()
}
}