zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.4k stars 650 forks source link

Fish shell command coloring not preserved/passed through properly to zellij session #1692

Open tpmoney opened 2 years ago

tpmoney commented 2 years ago

Zellij appears to be overriding/replacing the colors that the fish shell uses on the command line with its own.

zellij --version: zellij 0.31.3 stty size: 24 80 uname -av or ver(Windows): Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64

fish --version: fish, version 3.5.1

Fish output in a terminal without zellij:

Screen Shot 2022-08-25 at 21 58 17

Fish output in zellij:

Screen Shot 2022-08-25 at 21 58 35
imsnif commented 2 years ago

Hey, I'm also using the same version of fish and this is not reproduced for me. Would you be willing to attach the debug logs as mentioned here: https://github.com/zellij-org/zellij/blob/main/.github/ISSUE_TEMPLATE/bug_report.md ? That way I'll be able to reproduce this and find the issue. Thanks!

tpmoney commented 2 years ago

Logs attached

zellij-9.log zellij.log

imsnif commented 2 years ago

Hey @tpmoney - I'm looking into this now, and the odd thing is that even with the attached log files I am unable to reproduce this. If I cat the log files inside a Zellij pane, it looks correct: img-2022-09-02-160336

This leads me to believe this is some sort of environment issue, and I would be very happy to get to the bottom of it. Would you be willing to help out with some troubleshooting?

Let's start with which terminal emulator you are using? Do you have a custom terminal/fish config? Did you always have this problem with Zellij, or did it start recently? If you change to a different terminal emulator, does it still happen? (this doesn't necessarily mean the problem is with the terminal emulator, it can still be a Zellij bug).

tpmoney commented 2 years ago

Sure thing. I'm using the built in terminal.app for macos monterey. This occurs on both a personal and a work computer, but I'll only be able to provide logs / data from the personal one. Using the "Pro" theme in the terminal app, which doesn't seem to have any odd color mappings. The colors map to the names as I'd expect (Black (0) on the left there, White(7) on the right, with the bright versions (8-15) below:

Screen Shot 2022-09-02 at 12 51 30

Terminal is declared as "xterm-256color" with UTF-8 encoding. Fish was installed via homebrew, and the issue has been since I installed zellij on either computer.

fish_color_autosuggestion | 93a1a1
fish_color_cancel | --reverse
fish_color_command | 586e75
fish_color_comment | 93a1a1
fish_color_cwd | green
fish_color_cwd_root | red
fish_color_end | 268bd2
fish_color_error | dc322f
fish_color_escape | 00a6b2
fish_color_history_current | --bold
fish_color_host | normal
fish_color_host_remote | yellow
fish_color_match | --background=brblue
fish_color_normal | normal
fish_color_operator | 00a6b2
fish_color_param | 657b83
fish_color_quote | 839496
fish_color_redirection | 6c71c4
fish_color_search_match | 'bryellow' '--background=white'
fish_color_selection | 'white' '--bold' '--background=brblack'
fish_color_status | red
fish_color_user | brgreen
fish_color_valid_path | --underline
fish_pager_color_completion | green
fish_pager_color_description | B3A06D
fish_pager_color_prefix | 'cyan' '--underline'
fish_pager_color_progress | 'brwhite' '--background=cyan'
fish_pager_color_selected_background | --background=white
TERM | xterm-256color

It does appear that the issue is somewhere between terminal.app and zellij because installing iterm2 seems to give me output like what you saw:

Screen Shot 2022-09-02 at 13 02 20
imsnif commented 2 years ago

@tlinford - can you reproduce this on your mac by any chance?

tlinford commented 2 years ago

I think so, on a vanilla setup I don't really see anything wrong, but once I started changing various fish_colors it starts to behave strangely.

Did a quick test with set_color and the result is indeed strange (zellij is on the right):

Screenshot 2022-09-09 at 10 55 54

With other terminal emulators this doesn't happen.

imsnif commented 2 years ago

Hmm... @tlinford - I have a wild guess. If you comment this out, does it fix it? https://github.com/zellij-org/zellij/blob/c89b416d764d80a72130821506f36157a08321e9/zellij-utils/src/envs.rs#L28

tlinford commented 2 years ago

Hmm... @tlinford - I have a wild guess. If you comment this out, does it fix it?

https://github.com/zellij-org/zellij/blob/c89b416d764d80a72130821506f36157a08321e9/zellij-utils/src/envs.rs#L28

looks like it to me - I didn' reproduce the original problem 100% but both messing with fish_color_* and doing set_color were ok without that line :)