fix(parse): correct quotes matching for TermExec commands #52
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.
Hey, after a while without using my
TermExec
commands I decided to trigger them and found that they weren't working properly since the command wasnull
instead of the passed value (e.g.git status
) when double quotes are used for enclosing the command. This PR aims to fix this behavior by checking two things before matching the command with the quoting.jit.os
.+shellslash
feature exists and if it is turned on.But, why check those things? Well, they're needed for some reasons:
shellescape
function works in a very peculiar way regarding the quoting.From the
shellescape
function docs:shellslash
feature is only for Windows, that means we also need to check its value in addition to point 1 if the current OS is Windows because of howshellescape
manages the quoting.So basically, what was happening is that if you have used double quotes for enclosing your command the
value:match(quotes)
statement will return nil because theshellescape
function enclosed the command in single quotes.I only have tested in Linux because I don't have access to a Windows machine, but should work as expected too. Let me know if something needs to be changed.