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

Container indicator, ⬢, not rendered properly on macOS #5903

Open
michel-slm opened this issue Apr 4, 2024 · 1 comment
Open

Container indicator, ⬢, not rendered properly on macOS #5903

michel-slm opened this issue Apr 4, 2024 · 1 comment
Labels
🐛 bug Something isn't working as expected.

Comments

@michel-slm
Copy link
Contributor

Bug Report

Current Behavior

When SSH-ing to a Linux host and then entering a Podman container (set up using Distrobox), the prompt is set to display info about the container by default (e.g. distribution and release version). This is displayed incorrectly on macOS (both in Terminal and iTerm2, even when using a Nerd Font) but works just fine on Linux

e.g.

michel in ~ 
⬢ [fedora:39] ❯ 
michel in ~ 
⬢ [debian:stable] ❯ 

On macOS the ⬢ is not shown at all, and after typing a few characters and erasing them with backspace, the first letter is still rendered

Expected Behavior

Additional context/Screenshots

Missing ⬢ and further rendering issues (no rendering issue if the prompt does not contain ⬢, e.g. outside a container)
iterm-broken-rendering-in-container

Same commands, on Linux
Screenshot from 2024-04-03 21-08-51

Possible Solution

Environment

  • Starship version: 1.18.2
  • Shell type: fish
  • Shell version: 3.7.0
  • Shell plugin manager: fisher
  • Terminal emulator: iTerm, Terminal
  • Operating system: macOS 14.3 to 14.4.1

Relevant Shell Configuration

if status is-interactive
    # Commands to run in interactive sessions can go here

    # vi mode
    fish_vi_key_bindings
    # https://fishshell.com/docs/current/interactive.html#vi-mode-commands
    function fish_user_key_bindings
        # Execute this once per mode that emacs bindings should be used in
        fish_default_key_bindings -M insert

        # Then execute the vi-bindings so they take precedence when there's a conflict.
        # Without --no-erase fish_vi_key_bindings will default to
        # resetting all bindings.
        # The argument specifies the initial mode (insert, "default" or visual).
        fish_vi_key_bindings --no-erase insert
    end

    # handle cases (e.g. macOS) where we can't set the default shell
    if not string match "*/fish" $SHELL >/dev/null
    	set -gx SHELL (command -v fish)
    end
    # Fisher
    if not [ -f ~/.config/fish/functions/fisher.fish ]
        curl -sL https://git.io/fisher | source; and fisher install jorgebucaran/fisher
    end
    if not [ -f ~/.config/fish/functions/up-or-search.fish ]
        fisher install 2m/fish-history-merge
    end
    # see https://mjhart.netlify.app/posts/2020-03-14-nix-and-fish.html
    if not [ -f ~/.config/fish/functions/fenv.fish ]
        fisher install oh-my-fish/plugin-foreign-env
    end
    if [ (uname) = 'Darwin' ]
        # Ctrl-O
	# https://apple.stackexchange.com/a/3255
        stty discard undef
        # Nix
	# https://github.com/lilyball/nix-env.fish
	if not [ -f ~/.config/fish/conf.d/nix-env.fish ]
	    fisher install lilyball/nix-env.fish
	end
	# this causes an error on fish --login / new windows
	# set: Tried to change the read-only variable “_”
        # if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]
        #     fenv source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
        # end
    end
    if [ -f ~/.cargo/env ]
        fenv source '~/.cargo/env'
    end
    if command -v starship >/dev/null
        starship init fish | source
    else
        echo 'INFO: starship not installed'
	echo '      curl -fsSL https://starship.rs/install.sh | sh'
    end
    # Editor
    if command -v nvim >/dev/null
	set -gx EDITOR nvim
    else if command -v vim >/dev/null
	set -gx EDITOR vim
    end
    # Remote / TTY / container
    # see https://superuser.com/a/1749811 for WSL
    if [ -d /run/host ] || [ "$XDG_SESSION_TYPE" = 'tty' ] || [ -f /proc/sys/fs/binfmt_misc/WSLInterop ]
      set -gx GPG_TTY (tty)
    end
end

# opam configuration
source /home/michel/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true

Starship Configuration

[nodejs]
# this module relies on Nerd Font glyphs, which is annoying
# https://github.com/starship/starship/pull/3544
# and I don't actually use NodeJS
disabled = true
@michel-slm michel-slm added the 🐛 bug Something isn't working as expected. label Apr 4, 2024
@DerRockWolf
Copy link

Have you tried using a different symbol for the container module?
Does it only happen with this symbol or generally with the container module?

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

No branches or pull requests

2 participants