Commit dcb3414
committed
fix(priority): don't insert empty [# ] cookie when clearing priority
Headline:set_priority only treated a blank priority as "remove the
cookie" when a cookie already existed. The other two branches ran when
the headline had no cookie yet. They always built a new cookie, even
when the priority was blank.
As a result, pressing <Space> at the priority prompt on a headline
without an existing cookie returned " " from PriorityState:prompt_user,
which fell through to an insertion branch and produced a literal
[# ] cookie instead of clearing the priority.
Bring the empty check to the top of set_priority so it applies to all
paths: if the trimmed priority is empty, remove the existing cookie if
present, otherwise do nothing. The insertion branches now only run with
a real priority and can no longer fabricate an empty cookie.1 parent 4f99b37 commit dcb3414
2 files changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
350 | 357 | | |
351 | | - | |
352 | | - | |
| 358 | + | |
353 | 359 | | |
354 | 360 | | |
355 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
| |||
0 commit comments