wego: Incorrect table alignment under some terminal emulators due to double-width characters
This is a followup to discussion on Alacritty commit 3ad68699 (Alacritty is a “cross-platform, GPU-accelerated terminal emulator”).
The problem is that, in some terminals, wego 2.0 table alignment suffers from the width of the unicode characters used (cloud, sun, etc). See for yourself:
- GNOME Terminal:
- Alacritty:
To me that looked like a bug in Alacritty, but its main developer, @jwilm, comments that:
I believe this is a bug with
wego
. They don’t account that terminals may display a cloud as 1 or 2 columns. GNOME Terminal appears to think the cloud icons are only single width. Alacritty (correctly) handles them as double width. We are using the Unicode 9 definitions for wide chars, so that may account for the difference.In the
wego
emoji frontend,ret = append(ret, fmt.Sprintf("%v %v %v", cur[1], icon[0], c.formatTemp(cond)))
you can see that there’s a space after the icon in the
Sprintf
format string. It’s not visible in GNOME Terminal because it’s under the emoji. You can see it in Alacritty because we account for the double width characters.
wego
should be using the goto functionality of terminals to handle both cases.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (7 by maintainers)
After fixing the variation selector bug in Alacritty, the current version of
wego
renders correctly:@ronjouch Yeah, still on my machine. I’ll push up a branch, but it’s not ready to merge into master. Let’s continue this discussion on the Alacritty tracker or IRC.