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

sed command wasn't properly removing color escapes #3

Merged
merged 1 commit into from
Aug 25, 2015

Conversation

jordanlewis
Copy link
Contributor

Previously, sack wasn't correctly sanitizing the colored results from
ack or ag. This patch changes the sed command used to sanitize the
colored results from using the hex representation of an escape, \x1B, to
using an escape literal, �. This corrects the problem.

Previously, sack wasn't correctly sanitizing the colored results from
ack or ag. This patch changes the sed command used to sanitize the
colored results from using the hex representation of an escape, \x1B, to
using an escape literal, �. This corrects the problem.
@sapegin
Copy link

sapegin commented Mar 10, 2013

It’s strange but both commands don’t work for me on a Mac: in Terminal.app and iTerm. But perl -pe "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mK]//g" works fine.

@danielb2
Copy link

👍 also having this problem. seems the author has vanished? 2 months no response :(

@KyleAMathews
Copy link

👍

@sampson-chen
Copy link
Owner

Sorry about this. I've been busy with school then new job. I'll do the pull
requests soon as there are several. Eventually there will be a more general
version in python or go
On Apr 4, 2014 11:47 AM, "Kyle Mathews" notifications@github.com wrote:

[image: 👍]

Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-39598104
.

@AlexRiedler
Copy link

The Mac OS X version does not work, a working version is:
sed -E "s/"$'\E'"\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g"

@mjwhitta
Copy link

Way late to the party but if you are on OSX with brew installed, you can fix this by doing the following:

$ brew install gnu-sed
$ mkdir -p ~/bin
$ cd ~/bin
$ ln -s $(which gsed) sed

This way you don't need to make any changes to sack.

@danielb2
Copy link

I've long since ditched sack to use the-silver-searcher

@mjwhitta
Copy link

If you like the-silver-searcher and the idea of sack, you could try zoom which was inspired by sack.

sampson-chen added a commit that referenced this pull request Aug 25, 2015
sed command wasn't properly removing color escapes
@sampson-chen sampson-chen merged commit d91d379 into sampson-chen:master Aug 25, 2015
@sampson-chen
Copy link
Owner

mjwhitta@ sack (Shortcut-Ack) also includes "sag" (Shortcut-Ag), which wraps ag (the-silver-searcher).

I looked at https://gitlab.com/mjwhitta/zoom -- awesome work!!

@mjwhitta
Copy link

When I was using sack, I did like sag. Unfortunately I found it didn't work with all the flags that sack supported. I created a pull request to fix it, but I wasn't sure it would get merged. I also have a bad (?) habit of rewriting tools from scratch myself so I can learn more about how they work, hence zoom.

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.

7 participants