fix(parse): skip forge refs in right-to-left metadata scan
Problem: `parse.body()` scans tokens right-to-left and breaks on the first non-metadata token. Forge refs like `gl:a/b#12` halted the scan, preventing metadata tokens to their left (e.g. `due:tomorrow`) from being parsed. Additionally, `diff.parse_buffer()` ignored `metadata.priority` from `+!!` tokens and only used checkbox-derived priority, and priority updates between two non-zero values were silently skipped. Solution: Recognize forge ref tokens via `forge.parse_ref()` during the right-to-left scan and skip past them, re-appending them to the description so `forge.find_refs()` still works. Prefer `metadata.priority` over checkbox priority in `parse_buffer()`, and simplify the priority update condition to catch all value changes.
This commit is contained in:
parent
b131d6d391
commit
fb76359579
4 changed files with 74 additions and 5 deletions
|
|
@ -63,7 +63,7 @@ function M.parse_buffer(lines)
|
|||
type = 'task',
|
||||
id = id and tonumber(id) or nil,
|
||||
description = description,
|
||||
priority = priority,
|
||||
priority = metadata.priority or priority,
|
||||
status = status,
|
||||
category = metadata.category or current_category or config.get().default_category,
|
||||
due = metadata.due,
|
||||
|
|
@ -146,10 +146,7 @@ function M.apply(lines, s, hidden_ids)
|
|||
task.category = entry.category
|
||||
changed = true
|
||||
end
|
||||
if entry.priority == 0 and task.priority > 0 then
|
||||
task.priority = 0
|
||||
changed = true
|
||||
elseif entry.priority > 0 and task.priority == 0 then
|
||||
if entry.priority ~= task.priority then
|
||||
task.priority = entry.priority
|
||||
changed = true
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue