Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comma cannot be used or escaped for keyword/trigger #19

Closed
b02860de585071a2 opened this issue Jul 7, 2024 · 3 comments
Closed

Comma cannot be used or escaped for keyword/trigger #19

b02860de585071a2 opened this issue Jul 7, 2024 · 3 comments

Comments

@b02860de585071a2
Copy link

b02860de585071a2 commented Jul 7, 2024

Trying to use a comma in the keyword does not work at all, however it can be used in the replacement text.

Suppose we have the following espanso yml:

matches:
  - trigger: ',,t'
    replace: "test"

With this, the ,,t would be interpreted literally. However in TT, this comes out as something like:

{"Trigger":",,t","Replace":"test","Vars":[],"Word":false}

(note the double quotes)

I might be missing something, but I have not found a way to interpret a keyword as a string literal. Importing a yml file (as mentioned above) does not work, most likely due to how it's converted into a json-friendly format.

Weirdly, other problematic characters are fine (", \, /, etc).

System info:

  • Version 6.9
  • Android 14
  • Pixel 8 Pro
@lochidev
Copy link
Owner

lochidev commented Jul 7, 2024

Thank you for the bug report. This is because I use these separators

[' ', '\n', ',']

to break a sentence into words. For ex:-

word1 word2, word3\nword4

into an array like

[word1, word2, word3, word4]

I then use the array to look in the dictionary for keywords. So, it's not great for triggers starting with those separators. I don't remember why I added the ',' into the separator list, may have been added to fix some bug before 😅. I guess I will remove it next update and see if no bugs pop up. Of course, this is assuming I understood what you wanted exactly. I assumed you don't want

',,t' to trigger -> test

but instead want

,,t to trigger -> test

EDIT: Just realized the solution is to add ", " into the separator list (with a space character) instead of ",". I'll include it in the next update.

@b02860de585071a2
Copy link
Author

b02860de585071a2 commented Jul 8, 2024

I don't remember why I added the ',' into the separator list, may have been added to fix some bug before 😅.

Probably some parsing thing, to make generating the json array easier on import/export? Considering that commas are fine in the expanded text, but not in keywords.

I assumed you don't want

',,t' to trigger -> test

but instead want

,,t to trigger -> test

Correct, I use ,, as a leader for espanso on my actual PC (best way I've found to avoid accidentally triggering matches in normal use while still being fast to type). The single quotes are just there to prevent a syntax error.

Ideally it should work with something like this:

,foo → bar

Or any arbitrary amount/placement of commas.

lochidev added a commit that referenced this issue Aug 4, 2024
@lochidev
Copy link
Owner

lochidev commented Aug 8, 2024

v6.9.1. Sorry this took way too long because I was trying to include bigger features in this release (forms support) but they need more testing.

@lochidev lochidev closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants