fix(priority): don't insert an empty [# ] cookie when clearing priority#1164
Open
liamrlawrence wants to merge 1 commit into
Open
fix(priority): don't insert an empty [# ] cookie when clearing priority#1164liamrlawrence wants to merge 1 commit into
liamrlawrence wants to merge 1 commit into
Conversation
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.
dcb3414 to
19e4218
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Headline:set_priorityonly treated a blank priority as "remove the cookie"when a cookie already existed. The other branches ran when the headline had no
cookie yet and always built a new one, even for a blank priority. As a result,
pressing
<Space>at the priority prompt on a headline with no existing cookiereturned
" "fromPriorityState:prompt_user, fell through to an insertionbranch, and produced a literal
[# ]cookie instead of clearing the priority.Changes
set_priorityso it applies to allpaths: 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.<Space>on a headline without an existing priority.Checklist
I confirm that I have:
Conventional Commits
specification (e.g.,
feat: add new feature,fix: correct bug,docs: update documentation).make test.