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

Fix passing arguments with spaces to external commands #217

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

eira-fransham
Copy link

@eira-fransham eira-fransham commented Aug 27, 2019

Surrounds the parameter passed to the -c/--command external executable with '..' and escapes the string appropriately. This means that when doing interactive grep using ripgrep you can type pub fn my_function_name - a very commonly-needed query - and get the correct result.

I assume this wasn't previously done for performance reason, so PR uses my lazy string replacement crate to avoid intermediate allocations. The speed should be pretty good despite escaping, surrounding with quotes and then replacing the {} (or other -I string) in the command parameter since that's all done in one pass.

From testing on my own computer the speed is very good, but that's just anecdotal evidence.

Previously nothing would be passed to the external command if the query was
empty, but the changes in skim-rs#217 caused it to instead pass an empty string.
This keeps compatibility with the previous behaviour
@LoricAndre
Copy link
Contributor

Given how far we have diverged since this was opened, I am sorry but I need to ask you to resolve the conflicts and merge master into this before we can review it properly.

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

Successfully merging this pull request may close these issues.

2 participants