--- title: bulk complete/delete act on stale task IDs status: closed labels: [bug] created: 2026-09-18 closed: --- `Task.ID` is just the 1-based line number assigned by `ReadTasks`, and the bulk handlers in the TUI iterate `for id := range m.selected` calling `CompleteTask`/`DeleteTask` one ID at a time (`tui.go` around lines 631 and 691). Both of those re-read `todo.txt` and rewrite it from scratch, so as soon as the first task is removed every line after it shifts down by one and the remaining IDs point at the wrong tasks. Map iteration order is random in Go, so which tasks get clobbered changes run to run. Completing a task that has a `rec:` also appends a new line, which shifts things further. Single-cursor (`d`/`x`/`r` on one task) is fine, and pin/wait are fine because `ToggleModifier` rewrites in place without changing line order. Fix: resolve the selection to raw lines up front and do a single read + single rewrite, the same way the bulk tag editor (`P/C/D/R`) already does.