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

Geodesic module displays broken character #417

Closed
osulli opened this issue Mar 21, 2019 · 19 comments
Closed

Geodesic module displays broken character #417

osulli opened this issue Mar 21, 2019 · 19 comments

Comments

@osulli
Copy link
Contributor

osulli commented Mar 21, 2019

what

  • Broken character in CLI.

why

  • Character should be escaped across all platforms.

Versions

FROM cloudposse/terraform-root-modules:0.58.1 as terraform-root-modules

FROM cloudposse/helmfiles:0.22.0 as helmfiles

FROM cloudposse/geodesic:0.77.2
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.10
Release:	18.10
Codename:	cosmic

Screenshot

image

 ✓   (healthera-sandbox-iac) aws ⨠ 
@osterman
Copy link
Member

@osulli can you explain why the markdown looks good with the and the screenshot looks bad?

@osterman
Copy link
Member

basically it comes down to us using an unsupported UTF8 character for your terminal. we can update our default, since you're not the first person to have the problem.

@osulli
Copy link
Contributor Author

osulli commented Mar 23, 2019

That's interesting. I didn't notice it working in the markdown.
I'm on my phone now and it looks ok, I wonder if it just doesn't work on ubuntu entirely.

@osulli
Copy link
Contributor Author

osulli commented Mar 28, 2019

From my Ubuntu 18 laptop:
image

It's clearly bigger than the terminal or Geodesic and clearly just a 'missing character' from ubuntu.

@osulli
Copy link
Contributor Author

osulli commented Mar 28, 2019

image

@tamsky
Copy link
Contributor

tamsky commented Mar 28, 2019

'missing character' from ubuntu.

To be clear, this is not an ubuntu-specific issue.
It's a missing glyph in the specific font or fonts being used in terminals or browsers.

Viewing this github comment in my browser, it's visible:
#417 (comment)

image

@tamsky
Copy link
Contributor

tamsky commented Mar 28, 2019

@osulli
what terminal program is in the screenshot?
are you able to determine what font your terminal is using?
have you tried any other fonts?

@Nuru
Copy link
Contributor

Nuru commented Mar 28, 2019

@osulli One option, if it works for you, is to set export PROMPT_STYLE=unicode in your preferences file. Those are the nicest glyphs, but are not the default because they are "ambiguous width" Unicode characters that cause serious issues with command line editing on some terminals. You can also use "plain" instead of "unicode" to get basic ASCII characters, but you may find that uglier than the broken Unicode glyph.

@Nuru
Copy link
Contributor

Nuru commented Mar 29, 2019

The broken glyph '⨠' is Z NOTATION SCHEMA PIPING from the "Supplemental Mathematical Operators" Unicode block. As you can infer from the word "Supplemental" it appears to be not as widely supported as some of the other code blocks. I like it (when it is supported) because it is big compared to the alternatives. More importantly, according to Ubuntu fonts it is a supported character on Ubutnu. So the real question @osulli is what font are you using in the terminal. You can use "Ubutnu monospace" which supports the character, or of course you can download any of a number of free fonts that support it, such as Google's Noto Mono or GNU Free Font Mono. See this article about how to install fonts (and see what you already have installed) on Ubutntu.

Alternative glyphs include

  • » ($'\u00bb') RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK most likely the most widely supported because it s from the Latin-1 supplement, but also the smallest.
  • ≫ ($'\u226b') MUCH GREATER-THAN and
  • ⋙ ($'\u22d9') VERY MUCH GREATER-THAN which are from the Mathematical Operators code block and therefore I would expect are more widely supported. Ubuntu is supposed to have them.
  • ➤ ($'\u27a4') BLACK RIGHTWARDS ARROWHEAD from the Dingbats block, and which is used in the "unicode" style of prompt
  • ▶︎ ($'\u25b6') BLACK RIGHT-POINTING TRIANGLE which is sometimes presented as an emoji (as GitHub likes to) ▶️

Geodesic does not currently support customizing the glyph by itself, but as I mentioned above, it supports 2 alternatives to the default, export PROMPT_STYLE=unicode and export PROMPT_STYLE=plain`, that you can try and see if you like better. If anyone has a better suggestion for the prompt glyph to use, please add it to the comments below.

@osulli
Copy link
Contributor Author

osulli commented Mar 29, 2019

@osulli
what terminal program is in the screenshot?
are you able to determine what font your terminal is using?
have you tried any other fonts?

Standard ubuntu terminal.

I was on "Monogspace Regular". I tried "Ubuntu Mono Regular" which also did not solve the glyph issue.
image

@osulli
Copy link
Contributor Author

osulli commented Mar 29, 2019

@Nuru
Happy to use the unicode setting.

As per #422 I figured on Geodesic 0.85.0 executing:
echo $GEODESIC_DOT_DIR would return /localhost/.geodesic, however it is not set.
The file is present and contains:

export PROMPT_STYLE=unicode

I also added and rebuilt my module with this in the Dockerfile but no luck:

# Geodesic customization
ENV GEODESIC_DOT_DIR=/localhost/.geodesic

Have I missed a setup instruction to use the geodesic dot file?

@Nuru
Copy link
Contributor

Nuru commented Mar 30, 2019

@osulli It is odd that your terminal still has this issue with the Ubuntu font. Is your terminal set to UTF-8 encoding? (Terminal -> Profile Preferences -> Compatibility tab -> Encoding:).

What is your locale set to? In particular, check LANG, LC_ALL, and LC_CTYPE. Try export LC_CTYPE="en_US.UTF-8" in your terminal before starting up the Geodesic shell and again inside the shell and see if that helps.

My apologies about your difficulty setting up your preferences. Reviewers did not like the name GEODESIC_DOT_DIR and so it got changed to GEODESIC_CONFIG_HOME in the code but the documentation did not get updated (until now). However, the default is still /localhost/.geodesic, so /localhost/.geodesic/preferences will get loaded even if you did not set any environment variable (unless there is a directory called /localhost/.geodesic/defaults in which case /localhost/.geodesic/preferences would be ignored and /localhost/.geodesic/defaults/preferences would be loaded instead.)

In any case, setting it in your preferences is just a convenience so that it is automatically set up the way you like. You can test out the setting by running export PROMPT_STYLE=unicode on the bash command line inside Geodesic and see the results immediately.

@Nuru
Copy link
Contributor

Nuru commented Apr 1, 2019

With release 0.86.2 we added a GEODISIC_PROMPT_GLYPHS environment variable that you can set to set your own glyphs to show up at the end of the prompt. Keep in mind you will probably want to include a space at the end.

@osulli
Copy link
Contributor Author

osulli commented Apr 1, 2019

In my terminal:

echo $LANG
en_GB.UTF-8

In my module:

echo $LANG $LC_ALL $LC_CTYPE
en_US.UTF-8 en_US.UTF-8

@osulli
Copy link
Contributor Author

osulli commented Apr 1, 2019

oscar@infinitum:~$ pwd
/home/oscar
oscar@infinitum:~$ cat .geodesic/preferences 
export PROMPT_STYLE=unicode

Thank you this works fine now.

@osulli
Copy link
Contributor Author

osulli commented Apr 1, 2019

@Nuru please can you give an example on how to use GEODISIC_PROMPT_GLYPHS?

@Nuru
Copy link
Contributor

Nuru commented Apr 2, 2019

@osulli Just set GEODISIC_PROMPT_GLYPHS to whatever string of characters you want at the end of the command line prompt.

-> Run 'assume-role' to login to AWS with aws-vault
 ⧉  demo
 ✗   (none) helmfiles ⨠ export GEODISIC_PROMPT_GLYPHS=$'\u00bb '
-> Run 'assume-role' to login to AWS with aws-vault
 ⧉  demo 
 ✗   (none) helmfiles » export GEODISIC_PROMPT_GLYPHS="tada! "
-> Run 'assume-role' to login to AWS with aws-vault
 ⧉  demo 
 ✗   (none) helmfiles tada! 

@Nuru
Copy link
Contributor

Nuru commented Apr 7, 2019

Considering this closed by #429, since we cannot auto-detect what characters are available. If someone has a better solution, please open a new issue or pull-request describing or implementing it.

@Nuru
Copy link
Contributor

Nuru commented Jan 21, 2022

Our updated recommendation is to install the noto font subset that includes the missing character

$ sudo apt update
$ sudo apt install fonts-noto-core

Alternatively, #756 introduces new options for changing the character, making our fallback recommendation setting export PROMPT_STYLE=fancy in your customizations. See the PR for details.

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

4 participants