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

Render is completely messed up #132

Closed
lenohard opened this issue May 12, 2024 · 12 comments
Closed

Render is completely messed up #132

lenohard opened this issue May 12, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@lenohard
Copy link

Describe the bug
There appears to be a rendering issue in the directory tree view where the text and the directory lines are overlapping or not aligned correctly.

To Reproduce
Steps to reproduce the behavior:
install it on Mac using brew
brew install superfile
open it using 'spf'
spf

Expected behavior
I expected the directories and files to be listed in a clear, non-overlapping manner with proper alignment.

Screenshots
image
I have tried on different terminals including iterm2, native terminal, Warp and Alacritty, the layout is similar.

System information (please complete the following information):

  • OS: macOS
  • Version 14.4.1
  • Superfile Version v1.1.2
@lenohard lenohard added the bug Something isn't working label May 12, 2024
@yorukot
Copy link
Owner

yorukot commented May 12, 2024

charmbracelet/lipgloss#30
It should be caused by font encoding. You can try change it to UTF-8 Encoding and CHCP 65001!

@lenohard
Copy link
Author

lenohard commented May 12, 2024

but the encoding of my terminal is already UTF8. the result of locale is

LANG="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_ALL="zh_CN.UTF-8"

this is the setting of iterm2:
image

I have tried export LANG=en_US.UTF-8, the issue persists.
How should I config on MacOS?

@Limwin94
Copy link

I'm using the UTF-8 setting on MacOS and have the same problem.

@yorukot
Copy link
Owner

yorukot commented May 13, 2024

I think this must have something to do with font decoding but I'm not sure how to set it up on macos.

@lenohard
Copy link
Author

Thanks for your patient comments. I will make more attempts and provide more valuable feedback for diagnosis.

@yorukot
Copy link
Owner

yorukot commented May 13, 2024

https://github.com/charmbracelet/bubbletea?tab=readme-ov-file#bubble-tea-in-the-wild
If possible, you can try installing other programs with borders to see if you have the same problem. :)
Thanks you so much!

@lenohard
Copy link
Author

Following the reference you provide in your first comments, I found the first FAQ of lipgloss on its README.md is exactly relavent:

Why are things misaligning? Why are borders at the wrong widths?
This is most likely due to your locale and encoding, particularly with regard to Chinese, Japanese, and Korean (for example, zh_CN.UTF-8 or ja_JP.UTF-8). The most direct way to fix this is to set RUNEWIDTH_EASTASIAN=0 in your environment.

After running 'export RUNEWIDTH_EASTASIAN=0' the layout is normal right away!
(it's interesting to note that there may not be many Chinese, Japanese, or Korean MacOS users of this useful and supercool tool yet 😂.)

@yorukot
Copy link
Owner

yorukot commented May 13, 2024

That really great!
I think this will be a frequently asked question in the future!

@yorukot yorukot pinned this issue May 27, 2024
@yorukot yorukot changed the title Rendering Issue in Directory Tree View Render is completely messed up May 27, 2024
@lunrenyi
Copy link
Contributor

lunrenyi commented Jul 23, 2024

Following the reference you provide in your first comments, I found the first FAQ of lipgloss on its README.md is exactly relavent:

Why are things misaligning? Why are borders at the wrong widths?
This is most likely due to your locale and encoding, particularly with regard to Chinese, Japanese, and Korean (for example, zh_CN.UTF-8 or ja_JP.UTF-8). The most direct way to fix this is to set RUNEWIDTH_EASTASIAN=0 in your environment.

After running 'export RUNEWIDTH_EASTASIAN=0' the layout is normal right away! (it's interesting to note that there may not be many Chinese, Japanese, or Korean MacOS users of this useful and supercool tool yet 😂.)

补充

  1. 复现 bug 的最小化案例:
LANG='zh_CN.UTF-8' spf
  1. RUNEWIDTH_EASTASIAN=0: 表示告诉支持该环境变量的程序,不要将东亚字符(如中文、日文、韩文)视为双宽字符。

  2. 缓解该问题的措施:

alias spf='RUNEWIDTH_EASTASIAN=0 spf'
alias spf='LANG=C.utf8 spf'  

@yorukot superfile 是一个很棒的工具👍

@lunrenyi
Copy link
Contributor

lunrenyi commented Sep 7, 2024

@yorukot I tried the latest 1.1.4 version, but the bug persists.
I'd like to know if a complete fix for this issue is being considered for the new version or subsequent releases?

@yorukot
Copy link
Owner

yorukot commented Sep 7, 2024

@lunrenyi
Do you mean it can be solved without changing the decoding?

If so, there are currently no plans to completely solve it, mainly because this part of the calculation is implemented by bubbletea.

@lunrenyi
Copy link
Contributor

lunrenyi commented Sep 11, 2024

@yorukot I've provided the x-cmd method for installing superfile, which might offer some help with this issue.
PR: #371

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants