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
buffer list layout irregular when buffer-name contain multi-byte character #170
Comments
Thanks, looks good, can you submit a pull request? |
Please rename |
…in buffer list. (helm-c-highlight-buffers): Use `helm-substring-by-width' calculate buffer name
* helm-buffers.el: Issue #170 Support multi-byte character in buffer lis...
…-string-to-width instead of helm-substring-by-width. * helm-utils.el: Remove helm-substring-by-width.
@luozengbin I replaced |
(string-width
(helm-substring-by-width "1ああ" 4) ; => "1あ "
) ; => 4
(string-width
(truncate-string-to-width "1ああ" 4) ; => "1あ"
) ; => 3 may be you can fix that like this. (concat (truncate-string-to-width str width)
(make-string
(- width (string-width str)) ? )) |
luozengbin notifications@github.com writes:
Ok, thanks for the test, I will just reuse your Thierry |
* helm-utils.el: put back helm-substring-by-width.
Well with (truncate-string-to-width "1ああ" 4 nil ? ) but I will keep your code for now. I still have no aligment though trying with a buffer named: |
truncate-string-to-width is seems good. japanese buffer names chinese buffer names |
The result is the same with: (truncate-string-to-width i helm-buffer-max-length nil ? ) and (helm-string-by-width i helm-buffer-max-length) |
* helm-utils.el: (helm-substring, helm-string-multibyte-p): New (helm-substring-by-width): Use them.
It is ok here with the buffer names you gave me, can you check on your side? |
hi thierryvolpiatto! Please forgive my terrible english. With this commit have not a good alignment on my side. as my case under windows os
under linux os
|
Keep using only `helm-substring-by-width' for all. This is not working with european fonts AND using multibyte strings as buffer names, but works fine with common Japonese/chinese fonts, so keep it like this for now. * helm-utils.el (helm-substring-by-width): Revert.
Ok thanks for checking. We will keep what is working for you, it doesn't matter if it don't align perfectly on my side as people So I have reverted, please check again if it's ok. Thanks again for your help on this. |
Thanks a lot. |
my screen capture
for support multi-byte character in buffer list. The function
helm-c-highlight-buffers
that defined inhelm-buffers.el
should use(string-width STRING)
instead(length SEQUENCE)
to calculatetruncbuf
variable.here is my solution
The following code to get substring with string width
fix helm-c-highlight-buffers for support multi-byte character
after fix
The text was updated successfully, but these errors were encountered: