helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
34.06k stars 2.52k forks source link

Helix not picking up true color when running inside Zellij #6728

Closed andradei closed 1 year ago

andradei commented 1 year ago

Summary

When inside Zellij, true colors are not being detected and themes can't be set.

Versions

Reproduction Steps

  1. Open a terminal (wezterm or windows terminal)
  2. Start wsl
  3. Open helix: theme is picked up and works
  4. Close helix
  5. Start a Zellij session
  6. Open helix: theme is borked, trying to set a new theme throws the following message

image

Helix log

~/.cache/helix/helix.log ``` 2023-04-12T13:54:16.283 helix_vcs [ERROR] failed to obtain current head name for /home/andradei/.config/helix/config.toml 2023-04-12T13:54:16.294 helix_view::editor [ERROR] Failed to initialize the LSP for `source.toml` { cannot find binary path } 2023-04-12T13:54:49.495 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T13:54:49.495 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T13:54:49.633 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T13:54:49.633 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:06:40.308 helix_vcs [ERROR] Error { context: "failed to open git repo", source: Discover( NoGitRepository { path: "/home/andradei/.config/helix", }, ), } 2023-04-12T14:06:40.308 helix_vcs [ERROR] failed to open diff base for /home/andradei/.config/helix/config.toml 2023-04-12T14:06:40.308 helix_vcs [ERROR] Error { context: "failed to open git repo", source: Discover( NoGitRepository { path: "/home/andradei/.config/helix", }, ), } 2023-04-12T14:06:40.308 helix_vcs [ERROR] failed to obtain current head name for /home/andradei/.config/helix/config.toml 2023-04-12T14:06:40.327 helix_view::editor [ERROR] Failed to initialize the LSP for `source.toml` { cannot find binary path } 2023-04-12T14:07:16.037 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:17.562 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:19.840 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:19.840 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:19.840 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:20.955 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:20.955 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:20.955 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:23.970 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:23.970 helix_view::theme [WARN] Theme: invalid modifier: "normal" 2023-04-12T14:07:23.981 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:24.232 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:24.626 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support 2023-04-12T14:07:28.070 helix_view::editor [ERROR] editor error: Unsupported theme: theme requires true color support ```

Platform

Ubuntu on WSL2

Terminal Emulator

wezterm 20230408-112425-69ae8472

Helix Version

helix 23.03 (3cf03723)

andradei commented 1 year ago

Opened an issue on Zellij, but it may be the case that the problem lies on the helix side https://github.com/zellij-org/zellij/issues/2359

andradei commented 1 year ago

Don't know what happened. Maybe I had to reboot the machine (?😂) but now it is working. No errors.

HollayHorvath commented 10 months ago

I'm having the same issue but only when I restart a Zellij session and that session has a Helix instance.

If I drop back to shell ([Esc]) and run Helix everything is good, but if I press [Enter] to run Helix it's on default theme and on :theme I only get base16_default and default themes. The only relevant line from the log: 2024-01-23T21:00:47.065 helix_term::application [WARN] failed to load theme `gruvbox_dark_hard` - Theme: file not found for: gruvbox_dark_hard

Terminal emulator: either xfce4-terminal or alacritty, doesn't seem to matter, my guess would be that it's caused by some kind of path issue.

Zellij: 0.39.2 Helix: 23.10

Edit: OS: Linux Mint (Ubuntu 22.04)

One thing I found is that it's the only process that is a session leader (px aux | rg hx, unnecessary columns dropped)

pts/11  Sl+  Jan02   0:05 /usr/lib/helix/hx
pts/20  Sl+  Jan09   0:09 /usr/lib/helix/hx weekly_hours
pts/17  Sl+  Jan21   2:29 /usr/lib/helix/hx .
pts/34  Sl+  Jan22   0:12 /usr/lib/helix/hx .
pts/5   Tl   11:33   0:00 /usr/lib/helix/hx /home/allegretto/.config/helix/languages.toml
pts/5    Tl  12:09   0:01 /usr/lib/helix/hx /home/allegretto/.config/helix/languages.toml
pts/24  Sl+  21:08   0:00 /usr/lib/helix/hx .
pts/18 Ssl+  21:15   4:44 /usr/lib/helix/hx . <- the offending one

Edit 2: I checked the environment variables of Helix when it produced the error and HELIX_RUNTIME is missing (also SHLVL is set to 1 but my config is actually 2).