5

I want to use an American flag emoji in my bash prompt (i.e. PS1 environment variable). However, the American flag emoji causes the terminal cursor to offset an extra character to the right.

is comprised of two unicode characters, and . I believe terminal is converting this to a mono-spaced emoji character (the flag), yet still allocating space for two characters. How can I achieve my expected cursor position?

I want:
Desktop user ls|

I get:
Desktop user ls | <-weird space offset of cursor

My ~/.bash_profile is:
export PS1=' \W \u '

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Andrew Kirna
  • 151
  • 3

1 Answers1

0

I know you said you use bashrc, but when I was customizing my zshrc config, I found out different terminals have different spacing between characters. I recommend trying out Terminator, kitty terminal and rxvt-unicode to see if one of them gives the result you want.

One important note is that if you use one of the nerdfonts at https://www.nerdfonts.com/ you might be able to achieve the terminal look you want. Fonts also play a part.

Marslander
  • 15
  • 3