Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.98k stars 9.62k forks source link

Installed & updated formulae green tick causes misaligned columns #1326

Closed OJFord closed 7 years ago

OJFord commented 7 years ago

The green ticks appended to updated formulae that are currently installed cause later columns to misalign: screen shot 2016-10-19 at 16 48 01

OJFord commented 7 years ago

Although actually, if I paste the output, it's fine:

==> Updated Formulae
allegro               dcmtk                 gnutls ✔              logtalk               pgrouting             vim ✔
ansiweather           docker ✔              grails                meson                 qca                   voltdb
apktool               docker-compose ✔      gwyddion              mg3a                  rtv                   yarn
armor                 dspdfviewer           jenkins               micropython           sflowtool             yaz
aubio                 elixirscript          jsonnet               mitmproxy             shyaml                zile
aws-elasticbeanstalk  exim                  latex2html            mkvtoolnix            svtplay-dl            zsh-autosuggestions
aws-sdk-cpp           fastd                 ldc                   monetdb               syncthing
awscli ✔              ffms2                 lfe                   natalie               terraform
codequery             folly                 libpointing           nvm                   tor
dbus                  git-lfs               linkerd               oysttyer              torsocks

Does that mean this is a font issue? I'm using "Anonymous Pro for Powerline" (I'm not using powerline, but it's the unicode-patched version).

MikeMcQuaid commented 7 years ago

Does that mean this is a font issue?

Yep, sorry. I don't get this from brew update using the default Terminal.app font. Nothing we can do here, I'm afraid.

apjanke commented 7 years ago

This may also depend on the terminal emulator you are running brew under. Fixed-width fonts don't actually include information on how many "columns" wide all characters are, just actual point-size/advance information for the glyph (and bounding box, I think?) (and "double-width" flags for some CJK characters, but not for emoji, I think). So programs that lay out text using character cell grids (like terminals) must use heuristics to determine how many character cells to allot for each character.

It's a thorny issue, and not one that could be fixed cleanly at the Homebrew level. (There's no "right" way to fix it globally, and not enough information is available to brew for a workaround.) If you want more background, do a search for "Unicode character widths" (especially "emoji") and the various terminal emulators, like iTerm2, Terminal.app, and rxvt-unicode.

If you want to keep using Anonymous Pro, you may have luck switching your terminal emulator, or upgrading to a different version. For what it's worth, Anonymous Pro for Powerline aligns correctly for me on OS X 10.11 El Capitan in iTerm 3.0.10, but not in Terminal.app 2.6.1. (In Terminal.app, the check marks take up two character cells, as in your screen shot. In iTerm, the check marks are still drawn wide, but they only advance one cell.)

Some terminals also have settings that can affect this heuristic behavior. For example, iTerm has a "Treat ambiguous-width characters as double width" setting under Profiles > Text. If you have that on, turning it off may resolve this. Terminal.app does not have such a setting, AFAIK.