Electrux / ls_extended

ls with coloring and icons
BSD 3-Clause "New" or "Revised" License
201 stars 14 forks source link

Chinese characters cause alignment problems #11

Closed brickmill closed 6 years ago

brickmill commented 6 years ago

Thanks for making this project! I just found a little bug:

extended

I'm using termite as my terminal.

MaT1g3R commented 6 years ago

I am having the same issue

Electrux commented 6 years ago

ok i think i know the reason. The UTF characters take more than 1 byte and hence, if we display them on screen, we have to add the padding columns with the number of extra bytes to compensate and hence display the columns correctly. However, for chinese characters, each character takes the space on screen - equivalent of 2 normal english characters and hence the column fails to compensate correctly, thereby adding extra columns and hence making it look like the screen shot above

Electrux commented 6 years ago

The chinese characters should be fixed now. Could you guys test please?

MaT1g3R commented 6 years ago

It seems like it still have some problems :(

screen shot 2018-06-16 at 2 11 09 pm

Electrux commented 6 years ago

those are japanese or korean characters right?

MaT1g3R commented 6 years ago

Those are Japanese characters

brickmill commented 6 years ago

Chinese characters seem to be working for me. Thanks!

gatlee commented 6 years ago

I think https://stackoverflow.com/questions/3634627/how-to-know-the-preferred-display-width-in-columns-of-unicode-characters would help fix this easily without having to manually search for languages with double spacing. I'll have a pull request up soon

Electrux commented 6 years ago

ok i made some changes... please see if this works now?

MaT1g3R commented 6 years ago

It still doesn't work :(

Here is the file list if you want to do some testing:

https://dpaste.de/o42x

screen shot 2018-06-16 at 8 09 32 pm

gatlee commented 6 years ago

https://github.com/termux/wcwidth I think this might work better than the other one which was updated in 2001. Seems to be a lot more comprehensive

gatlee commented 6 years ago

I have a potential fix that I'm working on. I think it should work

Electrux commented 6 years ago

oh that's amazing! i eagerly await it. I am also trying to find a fix myself in the meantime :)

Electrux commented 6 years ago

Updated the codebase to version 1.0.7. It should have support for much greater range of full width characters. Could you guys please try it?

MaT1g3R commented 6 years ago

It is still not working correctly 😢

Electrux commented 6 years ago

ok i used the list of files u gave me and was able to find the character sets responsible. According to your file list, it should now work from version 1.0.8 😄

Electrux commented 6 years ago

Please use it and see if it works correctly :)

MaT1g3R commented 6 years ago

It is fixed! Thank you so much

Electrux commented 6 years ago

Awesome! Thanks a lot :D