fix(diff): preserve due/rec when absent from buffer line
Problem: `diff.apply` overwrites `task.due` and `task.recur` with `nil` whenever those fields aren't present as inline tokens in the buffer line. Because metadata is rendered as virtual text (never in the line text), every description edit silently clears due dates and recurrence rules. Solution: Only update `due`, `recur`, and `recur_mode` in the existing- task branch when the parsed entry actually contains them (non-nil). Users can still set/change these inline by typing `due:<date>` or `rec:<rule>`; clearing them requires `:Pending edit <id> -due`.
This commit is contained in:
parent
4187357a41
commit
87679e9857
2 changed files with 27 additions and 12 deletions
|
|
@ -121,17 +121,19 @@ function M.apply(lines, s, hidden_ids)
|
|||
task.priority = entry.priority
|
||||
changed = true
|
||||
end
|
||||
if task.due ~= entry.due then
|
||||
if entry.due ~= nil and task.due ~= entry.due then
|
||||
task.due = entry.due
|
||||
changed = true
|
||||
end
|
||||
if task.recur ~= entry.rec then
|
||||
task.recur = entry.rec
|
||||
changed = true
|
||||
end
|
||||
if task.recur_mode ~= entry.rec_mode then
|
||||
task.recur_mode = entry.rec_mode
|
||||
changed = true
|
||||
if entry.rec ~= nil then
|
||||
if task.recur ~= entry.rec then
|
||||
task.recur = entry.rec
|
||||
changed = true
|
||||
end
|
||||
if task.recur_mode ~= entry.rec_mode then
|
||||
task.recur_mode = entry.rec_mode
|
||||
changed = true
|
||||
end
|
||||
end
|
||||
if entry.status and task.status ~= entry.status then
|
||||
task.status = entry.status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue