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

Allow zero for --highlight-lines value #124

Closed
bkuhlmann opened this issue Nov 5, 2020 · 5 comments
Closed

Allow zero for --highlight-lines value #124

bkuhlmann opened this issue Nov 5, 2020 · 5 comments

Comments

@bkuhlmann
Copy link

bkuhlmann commented Nov 5, 2020

Overview

Would it be possible to allow zero as a safe value for --highlight-lines? Example:

silicon --to-clipboard --highlight-lines 0 example.rb

Essentially, a value of zero would be like a no-op and as if the --highlight-lines option was never used. The reason why this is valuable is for wrapping in a shell script. Without this being possible, the following error happens instead:

Segmentation fault: 11

Screenshots/Screencasts

Here is an example of a shell script that sets --highlight-lines to zero as a default option which will fail with the above mentioned error. It would be nice to allow zero in this situation.

image

Steps to Recreate

touch example.rb
silicon --to-clipboard --highlight-lines 0 example.rb

Desired Behavior

Don't throw a segfault and ignore --highlight-lines instead since it's a no-op.

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 5, 2020

I test it but didn't get a segfault. But the result is strange, I should indeed ignore line 0.

image

@bkuhlmann
Copy link
Author

Yeah, strange you don't see the segfault. If it helps, here is some extra diagnostic info:

silicon --version
silicon 0.3.2

Operating System
macOS (10.15.6 (19G2021)), x86_64-darwin19

@Aloxaf Aloxaf closed this as completed in e4417f5 Nov 5, 2020
@bkuhlmann
Copy link
Author

Hey @Aloxaf, will you be releasing a new Homebrew version with the above fix soon? I'd love to pick up this fix if possible. 😉

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 30, 2020

Ok. I will make a release soon.

@bkuhlmann
Copy link
Author

Awesome, thanks and thanks for the fix too!

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