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

[Kitty] Ranger does not display devicons #2169

Closed
tbrodbeck opened this issue Nov 27, 2020 · 13 comments
Closed

[Kitty] Ranger does not display devicons #2169

tbrodbeck opened this issue Nov 27, 2020 · 13 comments

Comments

@tbrodbeck
Copy link

tbrodbeck commented Nov 27, 2020

Runtime Environment

  • Operating system and version: macOS 14.01
  • Terminal emulator and version: kitty 0.19.2
  • Ranger version/commit: ranger version: ranger 1.9.3
  • Python version: 2.7.16 (default, Oct 30 2020, 02:15:49) [GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri
  • Locale: None.None
  • shell: zsh 5.8 (x86_64-apple-darwin20.0)

Current Behavior

When using kitty the devicons (https://github.com/alexanderjeurissen/ranger_devicons) the icons are sometimes shown and sometimes not. Instead there are those characters:
problem

Expected Behavior

Display devicons to the left of files and directories.

Context

If I start kitty from another terminal (not kitty), the devicons are shown as expected.
BTW, I have already discussed with the creator of kitty about that issue: kovidgoyal/kitty#3124

Steps to reproduce

  1. Install alexanderjeurissen/ranger_devicons
  2. Open kitty
  3. type ranger
@toonn
Copy link
Member

toonn commented Nov 27, 2020

Hmm, I have no idea what the issue might be, tbh. @kovidgoyal, maybe you recognize this issue?

@kovidgoyal
Copy link

From the screenshot, it seems clear ranger is producing things like ~W instead of unicode codepoints correspondining to the icons. Why is it doing so, I have no idea.

@toonn
Copy link
Member

toonn commented Nov 28, 2020

@kovidgoyal, there's no difference in what the plugin does. So this change must be coming from the environment. Maybe kitty defaults to a different locale than other terminals or something?

@kovidgoyal
Copy link

That's what I originally suggested to the OP, but he insists he has set
all environment variables correctly.

@toonn
Copy link
Member

toonn commented Nov 28, 2020

My apologies, I missed the existing issue linked in the OP.
All the plugin does is prefix displayed filenames with a unicode character string. The only reason i can think of for that to get displayed as ASCII is an encoding problem either when reading those strings form the devicon.py file or when writing them to the terminal. Since encoding depends on locale this points to a locale issue.

@tbrodbeck, what are the values of LANG and all the LC_* variables and do they not differ at all between the environments? Are you running ranger with the same python executable?

@tbrodbeck
Copy link
Author

Hey when I use export LC_CTYPE=UTF-8 before starting ranger it actually works. Great. Then this is the variable that makes the difference.

@kovidgoyal As I described in the issue I already used env LC_CTYPE=UTF-8 in the kitty.conf but this actually does not seem to work. Can you maybe clarify how to setup the environment for kitty?

@kovidgoyal
Copy link

It works fine. Probably your shell is overriding it, look in your shell
rc files.

@tbrodbeck
Copy link
Author

tbrodbeck commented Nov 30, 2020

I am not sure about that. I tried launching kitty with several shells (including the default one) and env | grep LC_CTYPE does not give any output. Thus I assume it is not overridden rather not set.

@kovidgoyal
Copy link

kitty --config NONE -o 'env=WORKS=yay' bash -c "env | grep WORKS; read"

will show you
WORKS=yay

The extra = after env is needed for use with -o, you dont need it in
kitty.conf

@kovidgoyal
Copy link

Oh yeah and now that I recall the value of LC_CTYPE=UTF-8 is ignored because of a bug in python, see kovidgoyal/kitty#1233 so if rander needs it for some reason, then set it explicitly in your shell rc scripts.

@tbrodbeck
Copy link
Author

Ah now things are clearer. :D
I added this to my shell file, now it is working. Thank you so much!

@toonn
Copy link
Member

toonn commented Nov 30, 2020

@kovidgoyal, am I understanding that issue right, this is a problem because kitty removes that env var from the environment as a workaround?

@kovidgoyal
Copy link

No, it only removes it if python adds it. It also removed it when the
user added it, which was why env didnt work, but that is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants