nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

zap (26A1) is wide in vim

Open powerman opened this issue 7 years ago • 3 comments

Subject of the issue

I've no idea is this an issue with fonts or Vim or terminals. Somehow "zap" icon became 2-symbol wide in Vim, while in shell/mcedit/mousepad it looks normal.

$ echo "'⚡'" 
'⚡'
$ echo "'⚡'" | vim -u /dev/null --noplugin -
# vim shows this, note extra space after zap:
# '⚡ '

This is not happens with all other icons, only with this one.

Your Setup

I've tried several fonts: RobotoMono Nerd Font, DroidSansMono Nerd Font, etc. I've tried several terminals: uxrvt, konsole. I'm using Gentoo Linux.

powerman avatar Mar 30 '17 22:03 powerman

@powerman Hey thanks for the report. I am seeing the same. It looks like this is how it is in the source (octicons).

Will do some more investigating.. but looks like to fix this would have to be some tweaking to the patcher script

ryanoasis avatar Mar 31 '17 00:03 ryanoasis

3 years later still a mystery :laughing: :cry:

ryanoasis avatar Apr 08 '20 03:04 ryanoasis

It looks the same even 5 years later, unless there was any patches that I am not aware of

LeviticusNelson avatar Jun 25 '22 02:06 LeviticusNelson

Firstly, you see the zap is 'yellow'. The zap patched in by Nerd Fonts is black-and-white.

On my machine it comes from Noto Color Emoji which is given precidience over the selected font by fontconfig rules. When I remove the Google font I get a nice one-cell-wide black-and-white zap.

The fontconfig line on my machine is here:

/etc/fonts/conf.avail/60-generic.conf:			<family>Noto Color Emoji</family> <!-- Google -->

So, what you get is what you (or some distro guy) has set up. Change your setup to get what you want ;-)

Finii avatar Jan 30 '23 12:01 Finii

@Finii Actually it's you see yellow zap - because GitHub (or browser) show it this way. :smile: In my console it's black&white. Anyway, today, about 6 years later, I don't have this issue, at least in vim using command I reported long time ago. изображение

powerman avatar Jan 30 '23 12:01 powerman

@Finii Actually it's you see yellow zap - because GitHub (or browser) show it this way

Well, no:

image

Top tilix with NotoColorEmoji.ttf removed, then copied into fonts and restarted tilix: Color zap Entered zap via ctrl+shift+u 2 6 a 1 enter

Finii avatar Jan 30 '23 14:01 Finii

I don't have this issue, at least in vim using command I reported long time ago

Well, your b&w zap still looks like 2 widths wide :grimacing: So issue is still there ;-)

Finii avatar Jan 30 '23 14:01 Finii

Well, your b&w zap still looks like 2 widths wide grimacing So issue is still there ;-)

The issue isn't in "2 width wide", it's in "2 with wide symbol itself plus 1 extra space symbol".

powerman avatar Jan 30 '23 17:01 powerman

For JetBrainsMono Nerd Font, it now only has the 1 extra space: Screenshot 2023-01-30 at 10 27 30 AM

LeviticusNelson avatar Jan 30 '23 18:01 LeviticusNelson

@LeviticusNelson which exact font are you using?

Edit: And which terminal?

Finii avatar Jan 30 '23 18:01 Finii

@powerman I guess I do not get it :grimacing: Maybe you can show with more screenshot and also tell me which font and terminal you use please.

Finii avatar Jan 30 '23 18:01 Finii

Ah sorry, I see..., I guess. In Tilix it looks like 'the icon and a blank' with just one insert. Trying to find out the why.

Finii avatar Jan 30 '23 18:01 Finii

@Finii Font: JetBrainsMono Nerd Font Regular Terminal: Alacritty (xterm-256color)

LeviticusNelson avatar Jan 30 '23 18:01 LeviticusNelson

Well, it seems there is yet another fontfallback thing...

image

The zap in writer like like the one in the font and is only one cell wide.

In gnome-terminal there is some obviously different zap that occupies 2 cells.

Finii avatar Jan 30 '23 18:01 Finii

It uses FreeSerif, but that is also NOT 2 'cells' wide.

I believe that is an extra handling in the terminals. Is it marked as 'is two wide' in the unicode table?

image

Finii avatar Jan 30 '23 19:01 Finii

After removing all fonts that have a 'zap', so that tofu will be shown...:

image

Still the 'zap' takes 2 cells.

Before

image

After

image

Finii avatar Jan 31 '23 06:01 Finii

According to unicode a terminal HAS TO render zap as wide character (i.e. 2 cells wide)

https://www.unicode.org/Public/15.0.0/ucd/EastAsianWidth.txt

image

The classification is W. See also https://www.unicode.org/reports/tr11/ :

# Field 0: Unicode code point value or range of code point values
# Field 1: East_Asian_Width property, consisting of one of the following values:
#         "A", "F", "H", "N", "Na", "W"
#  - All code points, assigned or unassigned, that are not listed
#      explicitly are given the value "N".

On W: https://www.unicode.org/reports/tr11/#ED4

For example in windows terminal you see this in the code here: https://github.com/microsoft/terminal/blob/main/src/types/CodepointWidthDetector.cpp

Whatever the font says is ignored and it is rendered 2 cells wide.

Edit: Add link to tr11-ED4

Finii avatar Jan 31 '23 07:01 Finii

We had equivalent problems with the MaterialDesignIcons that are/were erroreously in the F900 - FDFF blocks, and some symbols were 'wide' while other were 'narrow' in terminals, but in the font all were the same width.

image

# The format is two fields separated by a semicolon.
# Field 0: Unicode code point value or range of code point values
# Field 1: East_Asian_Width property, consisting of one of the following values:
#         "A", "F", "H", "N", "Na", "W"
#  - All code points, assigned or unassigned, that are not listed
#      explicitly are given the value "N".
#  - The unassigned code points in the following blocks default to "W":
#         CJK Unified Ideographs Extension A: U+3400..U+4DBF
#         CJK Unified Ideographs:             U+4E00..U+9FFF
#         CJK Compatibility Ideographs:       U+F900..U+FAFF

Edit: Add tr11 excerpt

Finii avatar Jan 31 '23 07:01 Finii

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.

github-actions[bot] avatar Aug 07 '23 00:08 github-actions[bot]