Page 1 of 1

Token deletion bug

PostPosted: Mon Dec 31, 2018 11:03 pm
by dolfs
I have a rule where I used a custom text token that I subsequently wanted to replace with just the pattern is contained. The token was not used anywhere. Yet when I selected it and hit "delete" I got the message that the token was being used in a subsequent action (it was most definitely not). Clicking "Delete" then cause another token to be removed from a condition before the one in which I attempted to delete the token, as well as from a rule after.

Here is the starting situation:
Image
Note that the <•Suffix> token is not used in the action! The <•Suffix> token contains the pattern <...> and the goal was to replace it with just that pattern. It is a cleanup because the token value is not used anywhere and would make the rule easier to read.

So, open the pattern and select the token:
Image

Now hitting "Delete" results in:
Image
Note that, somehow, Hazel seems to think I am dealing with the token to the left of it, and that one is indeed used in an action below.

Subsequently clicking on "Delete" results in this:
Image
The <•Suffix> token was indeed removed from the condition I was editing, but the other token <•Date From Prefix> was removed from the condition before and after, but not from the condition I was editing. It was also removed from the action. This is particularly annoying because the other two occurrences of <•Date From Prefix> contain different patterns that are also subsequently lost.

Although the issue can be avoided by first removing the <•Date From Prefix> token from the action, then deleting the <•Suffix> token (no warnings or problems this way), and then reinstitution of the token in the action, I consider this a bug.

Related, but separate I could see an improvement where merely deleting a token elsewhere (in those scenarios where that would actually be correct), allowing the warning to have two choices:
  • Delete token, but replace with its pattern
  • Delete token and its pattern

This (choosing the first alternative) would at least preserve what each condition was matching, reducing the odds unexpected side effects of such an edit.

Re: Token deletion bug

PostPosted: Wed Jan 02, 2019 10:16 am
by Mr_Noodle
I think this is fixed in the development build as I did fix something related to this. I can't replicate it here, nonetheless. If you'd like to run a test build, email in to support so I can be sure that it also fixes your case.