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 regular expression for ANSI escapes #3615

Merged
merged 1 commit into from Jul 11, 2013
Merged

Conversation

minrk
Copy link
Member

@minrk minrk commented Jul 11, 2013

wouldn't catch \x1b[01;, only \x1b[0; or \x1b[1;.

closes #3614

wouldn't catch `\x1b[01;`, only `\x1b[0;` or `\x1b[1;`.

closes ipython#3614
@ivanov
Copy link
Member

ivanov commented Jul 11, 2013

still there... doesn't fix it

@minrk
Copy link
Member Author

minrk commented Jul 11, 2013

did you refresh? I did ls --color on my linux machine, saw the escapes, merged #3615, and the escapes are gone and the text is colored.

Can you paste the output (a = !ls) here, so I can see what it's still failing to catch?

@fperez
Copy link
Member

fperez commented Jul 11, 2013

Yup, still here for me too, after refresh:

image

@minrk
Copy link
Member Author

minrk commented Jul 11, 2013

Everybody's colors are different from mine! Probably just another small tweak.

@minrk
Copy link
Member Author

minrk commented Jul 11, 2013

Wait, @fperez, how is the output of a = !ls different from the output of !ls? I thought those did the same thing.

@minrk
Copy link
Member Author

minrk commented Jul 11, 2013

Might be aliases? What do you get from a = !ls --color?

@fperez
Copy link
Member

fperez commented Jul 11, 2013

output

['\x1b[0m\x1b[00manimation.m4v\x1b[0m',
 '\x1b[00mAnimations Using clear_output.ipynb\x1b[0m',
 '\x1b[00mCell Magics.ipynb\x1b[0m',
 '\x1b[00mCustom Display Logic.ipynb\x1b[0m',
 '\x1b[00mCython Magics.ipynb\x1b[0m',
 '\x1b[00mData Publication API.ipynb\x1b[0m',
 '\x1b[00mFrontend-Kernel Model.ipynb\x1b[0m',
 '\x1b[01;36mlogo\x1b[0m',
 '\x1b[00mOctave Magic.ipynb\x1b[0m',
 '\x1b[00mPart 1 - Running Code.ipynb\x1b[0m',
 '\x1b[00mPart 2 - Basic Output.ipynb\x1b[0m',
 '\x1b[00mPart 3 - Pylab and Matplotlib.ipynb\x1b[0m',
 '\x1b[00mPart 4 - Markdown Cells.ipynb\x1b[0m',
 '\x1b[00mPart 5 - Rich Display System.ipynb\x1b[0m',
 '\x1b[00mProgress Bars.ipynb\x1b[0m',
 '\x1b[00mpython-logo.svg\x1b[0m',
 '\x1b[00mREADME.md\x1b[0m',
 '\x1b[00mR Magics.ipynb\x1b[0m',
 '\x1b[00mScript Magics.ipynb\x1b[0m',
 '\x1b[00mSymPy Examples.ipynb\x1b[0m',
 '\x1b[00mTrapezoid Rule.ipynb\x1b[0m',
 '\x1b[00mTypesetting Math Using MathJax.ipynb\x1b[0m',
 '\x1b[00mUntitled0.ipynb\x1b[0m',
 '\x1b[00mUntitled1.ipynb\x1b[0m']

@fperez
Copy link
Member

fperez commented Jul 11, 2013

Paul, refresh again :) We were just going over this here, and it took several refreshes for me, but it's now OK.

Better yet, try with an incognito tab to make sure there's no shared cache.

As far as I can tell, this is good to go.

@ivanov
Copy link
Member

ivanov commented Jul 11, 2013

Ah, ok, I figured it out. ANSI colors do work

Here's what I was seeing, because I recently started using solarized dircolors:

In [1]: a = !ls --color ~/code/ipython

In [2]: a
Out[2]:
['\x1b[0m\x1b[00;38;5;244mall\x1b[0m',
 '\x1b[00;38;5;244mall2\x1b[0m',
 '\x1b[00;38;5;244mCOPYING.txt\x1b[0m',
 '\x1b[00;38;5;244mcur\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mdocs\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mexamples\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mgit-hooks\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mIPython\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mipython.egg-info\x1b[0m',
 '\x1b[00;38;5;244mMakefile\x1b[0m',
 '\x1b[00;38;5;244mMANIFEST.in\x1b[0m',
 '\x1b[00;38;5;244mPR\x1b[0m',
 '\x1b[00;38;5;244mREADME.rst\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mscripts\x1b[0m',
 '\x1b[00;38;5;244m:seteditor=vim\x1b[0m',
 '\x1b[00;38;5;244msetup2.pyc\x1b[0m',
 '\x1b[00;38;5;244msetupbase.py\x1b[0m',
 '\x1b[00;38;5;244msetupbase.pyc\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[01;38;5;64msetupegg.py\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33msetupext\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[01;38;5;64msetup.py\x1b[0m',
 '\x1b[00;38;5;244m\x1b[m\x1b[00;38;5;33mtools\x1b[0m',
 '\x1b[00;38;5;244mtox.ini\x1b[0m']

would it be hard to make get 256 color support? if so, just go ahead and merge

@ivanov
Copy link
Member

ivanov commented Jul 11, 2013

for reference, the way i got my LS_COLORS was:

$ LS_COLORS='no=00;38;5;244:rs=0:di=00;38;5;33:ln=01;38;5;33:mh=00:pi=48;5;230;38;5;136;01:so=48;5;230;38;5;136;01:do=48;5;230;38;5;136;01:bd=48;5;230;38;5;244;01:cd=48;5;230;38;5;244;01:or=48;5;235;38;5;160:su=48;5;160;38;5;230:sg=48;5;136;38;5;230:ca=30;41:tw=48;5;64;38;5;230:ow=48;5;235;38;5;33:st=48;5;33;38;5;230:ex=01;38;5;64:*.tar=00;38;5;61:*.tgz=01;38;5;61:*.arj=01;38;5;61:*.taz=01;38;5;61:*.lzh=01;38;5;61:*.lzma=01;38;5;61:*.tlz=01;38;5;61:*.txz=01;38;5;61:*.zip=01;38;5;61:*.z=01;38;5;61:*.Z=01;38;5;61:*.dz=01;38;5;61:*.gz=01;38;5;61:*.lz=01;38;5;61:*.xz=01;38;5;61:*.bz2=01;38;5;61:*.bz=01;38;5;61:*.tbz=01;38;5;61:*.tbz2=01;38;5;61:*.tz=01;38;5;61:*.deb=01;38;5;61:*.rpm=01;38;5;61:*.jar=01;38;5;61:*.rar=01;38;5;61:*.ace=01;38;5;61:*.zoo=01;38;5;61:*.cpio=01;38;5;61:*.7z=01;38;5;61:*.rz=01;38;5;61:*.apk=01;38;5;61:*.jpg=00;38;5;136:*.JPG=00;38;5;136:*.jpeg=00;38;5;136:*.gif=00;38;5;136:*.bmp=00;38;5;136:*.pbm=00;38;5;136:*.pgm=00;38;5;136:*.ppm=00;38;5;136:*.tga=00;38;5;136:*.xbm=00;38;5;136:*.xpm=00;38;5;136:*.tif=00;38;5;136:*.tiff=00;38;5;136:*.png=00;38;5;136:*.svg=00;38;5;136:*.svgz=00;38;5;136:*.mng=00;38;5;136:*.pcx=00;38;5;136:*.dl=00;38;5;136:*.xcf=00;38;5;136:*.xwd=00;38;5;136:*.yuv=00;38;5;136:*.cgm=00;38;5;136:*.emf=00;38;5;136:*.eps=00;38;5;136:*.pdf=01;38;5;245:*.tex=01;38;5;245:*.rdf=01;38;5;245:*.owl=01;38;5;245:*.n3=01;38;5;245:*.tt=01;38;5;245:*.nt=01;38;5;245:*.log=00;38;5;240:*.bak=00;38;5;240:*.aux=00;38;5;240:*.bbl=00;38;5;240:*.blg=00;38;5;240:*.aac=00;38;5;166:*.au=00;38;5;166:*.flac=00;38;5;166:*.mid=00;38;5;166:*.midi=00;38;5;166:*.mka=00;38;5;166:*.mp3=00;38;5;166:*.mpc=00;38;5;166:*.ogg=00;38;5;166:*.ra=00;38;5;166:*.wav=00;38;5;166:*.axa=00;38;5;166:*.oga=00;38;5;166:*.spx=00;38;5;166:*.xspf=00;38;5;166:*.mov=01;38;5;166:*.mpg=01;38;5;166:*.mpeg=01;38;5;166:*.m2v=01;38;5;166:*.mkv=01;38;5;166:*.ogm=01;38;5;166:*.mp4=01;38;5;166:*.m4v=01;38;5;166:*.mp4v=01;38;5;166:*.vob=01;38;5;166:*.qt=01;38;5;166:*.nuv=01;38;5;166:*.wmv=01;38;5;166:*.asf=01;38;5;166:*.rm=01;38;5;166:*.rmvb=01;38;5;166:*.flc=01;38;5;166:*.avi=01;38;5;166:*.fli=01;38;5;166:*.flv=01;38;5;166:*.gl=01;38;5;166:*.axv=01;38;5;166:*.anx=01;38;5;166:*.ogv=01;38;5;166:*.ogx=01;38;5;166:';
$ export LS_COLORS

@fperez
Copy link
Member

fperez commented Jul 11, 2013

Given our timeline, I suggest merging this as-is for now. Full 256-color terminal are still considered a bit of an exotic tool, so let's be realistic and cut what's a bug fix out, not a feature enhancement.

I'm merging as-is in 5 minutes unless I hear otherwise.

@minrk, thanks for the quick turnaround!

@ivanov
Copy link
Member

ivanov commented Jul 11, 2013

sounds good to me, i'll open an enhancement request for the future

@fperez
Copy link
Member

fperez commented Jul 11, 2013

OK, merging then. Thanks!

fperez added a commit that referenced this pull request Jul 11, 2013
Fix regular expression for ANSI escapes, which wouldn't catch `\x1b[01;`, only `\x1b[0;` or `\x1b[1;`.

Closes #3614.
@fperez fperez merged commit dbdad0b into ipython:master Jul 11, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Fix regular expression for ANSI escapes, which wouldn't catch `\x1b[01;`, only `\x1b[0;` or `\x1b[1;`.

Closes ipython#3614.
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.

ansi escapes broken in master (ls --color)
3 participants