-
Notifications
You must be signed in to change notification settings - Fork 16
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
Filename width fix #5
Conversation
And I am done for today. |
@@ -83,8 +84,9 @@ func maximumNameLength(filenames []string) int { | |||
max := 0 | |||
for _, name := range filenames { | |||
base := filepath.Base(name) | |||
if len(base) > max { | |||
max = len(base) | |||
width := runewidth.StringWidth(base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a bit more costly than len(string), calling only once per loop and instead using temporary variable.
Sorry. I don't know. |
I will try to check that out too 💪 |
Hi @NHOrus . |
I think if you succeed it would be great to put in it's own library. Because, well, not a question of width of symbol, but width of a glyph in font. Also, willing to help with that. |
Sure. But, even if it can not be solved in all environments , it may be able to solve to some extent (for example: limited to monospaced fonts) 💪 |
Maybe this can help? https://godoc.org/golang.org/x/text/width |
Some people have unicode filenames. They obviously misalign with naive width calculations.