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

IPython.utils.columnize sometime wrong... #1860

Closed
Carreau opened this issue Jun 5, 2012 · 3 comments · Fixed by #1875
Closed

IPython.utils.columnize sometime wrong... #1860

Carreau opened this issue Jun 5, 2012 · 3 comments · Fixed by #1875

Comments

@Carreau
Copy link
Member

Carreau commented Jun 5, 2012

In [1]: import IPython.utils.text as ut
   ...: len(ut.columnize(['x'*40,'x'*40],displaywidth=80).split('\n')[0])
Out[1]: 82 # should be < 80

two 40 letters words separated by 2 char could not enter on a 80 char line.
should be 2 times 40(+separator size maybe)

@Carreau
Copy link
Member Author

Carreau commented Jun 5, 2012

cf http://hg.python.org/cpython/file/2.7/Lib/cmd.py#l349
for a working implementation.

@takluyver
Copy link
Member

Do we need anything over and above what's in cmd, or can we just call that?

@Carreau
Copy link
Member Author

Carreau commented Jun 6, 2012

I'll need a little more abstract methods for #1851 that return a nested list.

As they are computated, it can also return the number of row, number of columns, and width of each column.
Then having the current columnize is just 2 lines of map/join, but I have the intermediate step that allow me to navigate the list up down, and easily insert the tag to hilight one particular item.

I was thinking of an abstart methods that takes a list of length, and return a nested list of array to have something really reusable.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
fix test that where wrong, add some others.

fix ipython#1860
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants