Skip to content

Commit

Permalink
Fixed bug where all pre checked todos were unchecked
Browse files Browse the repository at this point in the history
See #2 for more details
  • Loading branch information
elliot40404 committed Jan 11, 2025
1 parent 79fe2f9 commit 57e0c81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
)

const (
Version = "0.0.5"
Version = "0.0.6"
Author = "elliot40404<avishek40404@gmail.com>"
Name = "modo"
Desc = "Modo is a simple cli app that lets you interact any text file that contains checkboxes in the markdown format."
Expand Down
7 changes: 4 additions & 3 deletions internal/renderer/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ func (r Renderer) Render() {
slog.Error("something went wrong", "error", err)
return
}
done := make(map[int]struct{})
for _, i := range out {
done[i] = struct{}{}
todo := r.List[i]
if !todo.Done {
r.List[i].ToggleChecked(r.File)
todo.ToggleChecked(r.File)
}
}
for _, i := range preselected {
todo := r.List[i]
if todo.Done {
if _, ok := done[i]; !ok {
r.List[i].ToggleChecked(r.File)
}
}
Expand Down

0 comments on commit 57e0c81

Please sign in to comment.