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

Escape characters in quoted "replace" values are not respected #12

Open
lucasvieites opened this issue Dec 29, 2024 · 2 comments
Open

Comments

@lucasvieites
Copy link

Hi there,
I have a couple of snippets that include escape characters, such as \n and \t. According to the espanso docs: "Note that strings using \n as the line terminator character, or \t for tab-spacing, or beginning with a YAML special character [...], must be quoted.".

Using this snippet as an example: "<ul>\n<li>$|$</li>\n</ul>"
When I add double quotes in the replace field in espanso-gui, it prints the quotes and the escape characters literally.
When I add the quotes directly in the config file, the snippet is printed as expected:

<ul>
<li></li>
</ul>
@smeech
Copy link

smeech commented Dec 29, 2024

Having added the string via the GUI, how does it appear in the .yml file?
The output you're describing suggests you'll see the replace: value has single, or no quotes.
How would espanso-gui know you're not wanting the literal string?

@lucasvieites
Copy link
Author

I've attached a couple of screenshots.
When I add a new item with double quotes in the GUI it looks like this:
espanso-gui_double_quotes_in_gui

And in the config file it looks like this; it has single quotes around the code:
espanso-gui_double_quotes_in_file

If I go and edit the config file, remove the single quotes and save, the GUI respects the change, and shows the item as follows:
espanso-gui_double_quote_after_edit
The line feeds are not shown in the GUI, but it doesn't touch the replace value.

This is fine, and is working as expected/designed.

To answer your second question: espanso-gui can't know the intentions of the user, but perhaps you can add a checkbox labeled "Escape chars" (or similar) that indicates that the user wants to maintain the double quotes as-is.

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