Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Take display width of characters into account #419

Merged
merged 2 commits into from
Nov 23, 2020
Merged

Conversation

avdv
Copy link
Collaborator

@avdv avdv commented Nov 21, 2020

Description

Special characters (such as chinese) have a bigger width in a terminal, so the alignment of columns breaks. We need to determine the display width of the characters to compute the proper padding needed for the next column.

@codecov-io
Copy link

codecov-io commented Nov 21, 2020

Codecov Report

Merging #419 (67ee230) into master (ba2307b) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #419      +/-   ##
==========================================
+ Coverage   89.23%   89.25%   +0.02%     
==========================================
  Files           8        8              
  Lines         511      512       +1     
==========================================
+ Hits          456      457       +1     
  Misses         55       55              
Impacted Files Coverage Δ
lib/colorls.rb 100.00% <100.00%> (ø)
lib/colorls/core.rb 90.30% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba2307b...67ee230. Read the comment docs.

@avdv
Copy link
Collaborator Author

avdv commented Nov 22, 2020

That does not really solve the problem, we need to use the https://github.com/janlelis/unicode-display_width gem

dependabot-preview bot and others added 2 commits November 22, 2020 21:19
Some Unicode characters, e.g. chinese, consume more space when displayed on a terminal
than a single roman character. To avoid alignment issues, try to determine the width
using the unicode-display_width gem.
@avdv avdv changed the title Use tabs for alignment of columns Take display width of characters into account Nov 23, 2020
@avdv avdv merged commit dccc52b into athityakumar:master Nov 23, 2020
@avdv avdv deleted the fix-416 branch November 23, 2020 07:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If the directory contains Chinese file names, alignment errors will occur
2 participants