mihaiconstantin / bujo

Bullet Journal syntax highlighting in VS Code Markdown files.
https://bujo.mihaiconstantin.com
MIT License
61 stars 9 forks source link

Keyboard shortcuts won't work when modifier is present #24

Open riccardoferretti opened 2 years ago

riccardoferretti commented 2 years ago

If I try to change the status of an item using the keyboard shortcut (e.g. option+x) I get an error if there is a modifier for the item (e.g. !) and there is no space before the modifier.

To reproduce:

  1. type - [ ]! this is an item
  2. press option+x

Note that with - [ ] ! this is an item it works as expected.

mihaiconstantin commented 2 years ago

Thanks for pointing this out, @riccardoferretti, and apologizes for the slow response—I was away for a few weeks.

I believe the issue occurs here: https://github.com/mihaiconstantin/bujo/blob/66a4f892f14faafd9e152f2c1b91223f485d6d56/src/models/Symbol.ts#L28

Because the Pattern.extractSymbol(symbol) fails to identify the line as a valid BuJo entry. This can be seen in the regex demo (i.e., https://regex101.com/r/ABVEf2/4) for the following text:

- [ ]! Some example task ^2rj7bd6p8pph

I will fix the regex pattern and push out an update. Thanks for catching this!