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

GNU ls columns #1

Closed
mahkoh opened this issue Jun 30, 2014 · 2 comments
Closed

GNU ls columns #1

mahkoh opened this issue Jun 30, 2014 · 2 comments

Comments

@mahkoh
Copy link

mahkoh commented Jun 30, 2014

You've been asking about how to calculate the columns.

First you'll have to calculate the the widths of strings which isn't easy when you have unicode file names: here

Then you'll have to get the width of the terminal: here (tested only on linux)

Then you'll have to calculate the actual widths of the columns the way GNU ls does it: here (this is very similar to the way GNU ls does it)

This code is from my own ls implementation which I'm too lazy to continue. If you want you can use it under the MIT license.

@ogham
Copy link
Owner

ogham commented Jul 2, 2014

Yay, thanks for this. I relicenced exa to MIT because that seemed to be the main one round these here parts, so there's now no issue of code sharing.

I'm going to take a look at your code and probably steal some of it because I can't bend my mind about the way that ls calculates the rows and columns.

@ogham
Copy link
Owner

ogham commented Jul 6, 2014

Started working on this today in the grid-view branch.

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